comment_user_cancel

Versions
7
comment_user_cancel($edit, $account, $method)

Implement hook_user_cancel().

Code

modules/comment/comment.module, line 1187

<?php
function comment_user_cancel($edit, $account, $method) {
  switch ($method) {
    case 'user_cancel_block_unpublish':
      db_update('comment')
        ->fields(array('status' => 0))
        ->condition('uid', $account->uid)
        ->execute();
      db_update('node_comment_statistics')
        ->fields(array('last_comment_uid' => 0))
        ->condition('last_comment_uid', $account->uid)
        ->execute();
      break;

    case 'user_cancel_reassign':
      db_update('comment')
        ->fields(array('uid' => 0))
        ->condition('uid', $account->uid)
        ->execute();
      db_update('node_comment_statistics')
        ->fields(array('last_comment_uid' => 0))
        ->condition('last_comment_uid', $account->uid)
        ->execute();
      break;

    case 'user_cancel_delete':
      module_load_include('inc', 'comment', 'comment.admin');
      $cids = db_query('SELECT c.cid FROM {comment} c WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
      comment_delete_multiple($cids);
      break;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.