You are here

function spam_delete_comment in Spam 5

Delete the comment and all replies

1 string reference to 'spam_delete_comment'
spam_comment_operations in ./spam.module
Return the function to call dependant on the $action requested.

File

./spam.module, line 3010

Code

function spam_delete_comment($cid) {
  global $user;
  $save_user = $user;
  if ($cid == 0) {
    return;
  }
  if ($comment = spam_load_comment($cid)) {
    $user = user_load(array(
      'uid' => 1,
    ));
    _comment_delete_thread($comment);
    _comment_update_node_statistics($comment->nid);
    $user = $save_user;
    cache_clear_all();
    watchdog('spam', t('Spam: deleted comment "%subject" and all replies.', array(
      '%subject' => $comment->subject,
    )));
    spam_log(SPAM_LOG, t('spam_delete_comment: deleted comment "%subject" and all replies.', array(
      '%subject' => $comment->subject,
    )), 'comment', $comment->cid);
  }
}