function comment_user_cancel

Same name in other branches
  1. 9 core/modules/comment/comment.module \comment_user_cancel()
  2. 8.9.x core/modules/comment/comment.module \comment_user_cancel()
  3. 10 core/modules/comment/comment.module \comment_user_cancel()

Implements hook_user_cancel().

File

modules/comment/comment.module, line 1408

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;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.