function dialog_comment_delete in Dialog 6
Same name and namespace in other branches
- 7 modules/dialog_comment/dialog_comment.module \dialog_comment_delete()
 
Menu page callback for comment/%ctools_js/delete/%
1 string reference to 'dialog_comment_delete'
- dialog_comment_menu in modules/
dialog_comment/ dialog_comment.module  - Implementation of hook_menu().
 
File
- modules/
dialog_comment/ dialog_comment.module, line 162  - Provides Dialog integration for the core comment module. NOTE: In order for the edit, delete and reply links on comments to work, you must patch the Drupal 6 comment module with the patch from http://drupal.org/node/374463#comment-2393592.
 
Code
function dialog_comment_delete($cid, $ajax = FALSE) {
  module_load_include('inc', 'comment', 'comment.admin');
  if (!$ajax) {
    return comment_delete($cid);
  }
  $comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', $cid));
  $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
  ctools_include('ajax');
  $form_state = array(
    'ajax' => TRUE,
    'title' => t('Edit comment'),
    'args' => array(
      $comment,
    ),
  );
  $output = dialog_form_wrapper('comment_confirm_delete', $form_state);
  if (empty($output)) {
    $output[] = dialog_command_display(t('Comment deleted'), t('Reloading...'));
    $output[] = ctools_ajax_command_reload();
  }
  ctools_ajax_render($output);
}