comment_delete
- Versions
- 4.6 – 4.7
comment_delete($cid)- 5 – 6
comment_delete($cid = NULL)- 7
comment_delete($cid)
Menu callback; delete a comment.
Code
modules/comment.module, line 871
<?php
function 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));
$output = '';
if (is_object($comment) && is_numeric($comment->cid)) {
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$form = array();
$form['comment'] = array('#type' => 'value', '#value' => $comment);
$output = confirm_form('comment_confirm_delete',
$form,
t('Are you sure you want to delete the comment %title?', array('%title' => theme('placeholder', $comment->subject))),
'node/'. $comment->nid,
t('Any replies to this comment will be lost. This action cannot be undone.'),
t('Delete'),
t('Cancel'));
}
else {
drupal_set_message(t('The comment no longer exists.'));
}
return $output;
}
?>Login or register to post comments 