Skip navigation
Help

comment_user_cancel

7 comment.module comment_user_cancel($edit, $account, $method)

Implements hook_user_cancel().

File

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

Code

function comment_user_cancel($edit, $account, $method) {
  switch ($method) {
    case 'user_cancel_block_unpublish':
      $comments = comment_load_multiple(array(), array('uid' => $account->uid));
      foreach ($comments as $comment) {
        $comment->status = 0;
        comment_save($comment);
      }
      break;

    case 'user_cancel_reassign':
      $comments = comment_load_multiple(array(), array('uid' => $account->uid));
      foreach ($comments as $comment) {
        $comment->uid = 0;
        comment_save($comment);
      }
      break;
  }
}