comment_delete_multiple
- Versions
- 7
comment_delete_multiple($cids)
Delete comments and all their replies.
Parameters
$cids The comment to delete.
Code
modules/comment/comment.module, line 1414
<?php
function comment_delete_multiple($cids) {
$comments = comment_load_multiple($cids);
if ($comments) {
// Delete the comments.
db_delete('comment')
->condition('cid', array_keys($comments), 'IN')
->execute();
foreach ($comments as $comment) {
field_attach_delete('comment', $comment);
module_invoke_all('comment_delete', $comment);
// Delete the comment's replies.
$child_cids = db_query('SELECT cid FROM {comment} WHERE pid = :cid', array(':cid' => $comment->cid))->fetchCol();
comment_delete_multiple($child_cids);
_comment_update_node_statistics($comment->nid);
}
}
}
?>Login or register to post comments 