Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function comment_user_cancel

Same name and namespace in other branches
  1. 10 core/modules/comment/comment.module \comment_user_cancel()
  2. 9 core/modules/comment/comment.module \comment_user_cancel()
  3. 8.9.x 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.