function _comment_delete_thread in Drupal 5
Same name and namespace in other branches
- 4 modules/comment.module \_comment_delete_thread()
- 6 modules/comment/comment.admin.inc \_comment_delete_thread()
2 calls to _comment_delete_thread()
- comment_confirm_delete_submit in modules/
comment/ comment.module - comment_multiple_delete_confirm_submit in modules/
comment/ comment.module - Perform the actual comment deletion.
File
- modules/
comment/ comment.module, line 1849 - Enables users to comment on published content.
Code
function _comment_delete_thread($comment) {
if (!is_object($comment) || !is_numeric($comment->cid)) {
watchdog('content', t('Can not delete non-existent comment.'), WATCHDOG_WARNING);
return;
}
// Delete the comment:
db_query('DELETE FROM {comments} WHERE cid = %d', $comment->cid);
watchdog('content', t('Comment: deleted %subject.', array(
'%subject' => $comment->subject,
)));
comment_invoke_comment($comment, 'delete');
// Delete the comment's replies
$result = db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE pid = %d', $comment->cid);
while ($comment = db_fetch_object($result)) {
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
_comment_delete_thread($comment);
}
}