You are here

function comment_delete in Drupal 6

Same name and namespace in other branches
  1. 4 modules/comment.module \comment_delete()
  2. 5 modules/comment/comment.module \comment_delete()
  3. 7 modules/comment/comment.module \comment_delete()

Menu callback; delete a comment.

Parameters

$cid: The comment do be deleted.

1 string reference to 'comment_delete'
comment_menu in modules/comment/comment.module
Implementation of hook_menu().

File

modules/comment/comment.admin.inc, line 216
Admin page callbacks for the comment module.

Code

function comment_delete($cid = NULL) {
  $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;
  $output = '';
  if (is_object($comment) && is_numeric($comment->cid)) {
    $output = drupal_get_form('comment_confirm_delete', $comment);
  }
  else {
    drupal_set_message(t('The comment no longer exists.'));
  }
  return $output;
}