Same name and namespace in other branches
  1. 4.6.x modules/comment.module \comment_delete()
  2. 4.7.x modules/comment.module \comment_delete()
  3. 6.x modules/comment/comment.admin.inc \comment_delete()
  4. 7.x modules/comment/comment.module \comment_delete()

Menu callback; delete a comment.

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

File

modules/comment/comment.module, line 1072
Enables users to comment on published content.

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;
}