/[drupal]/drupal/modules/comment/comment.module
ViewVC logotype

Diff of /drupal/modules/comment/comment.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.680 by dries, Sun Jan 4 16:19:39 2009 UTC revision 1.681 by webchick, Thu Jan 8 08:42:12 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: comment.module,v 1.679 2009/01/04 16:10:48 dries Exp $  // $Id: comment.module,v 1.680 2009/01/04 16:19:39 dries Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 697  function comment_nodeapi_rss_item($node) Line 697  function comment_nodeapi_rss_item($node)
697  }  }
698    
699  /**  /**
700   * Implementation of hook_user_delete().   * Implementation of hook_user_cancel().
701   */   */
702  function comment_user_delete(&$edit, &$user, $category = NULL) {  function comment_user_cancel(&$edit, &$account, $method) {
703    db_update('comment')    switch ($method) {
704      ->fields(array('uid' => 0))      case 'user_cancel_block_unpublish':
705      ->condition('uid', $user->uid)        db_update('comment')->fields(array('status' => 0))->condition('uid', $account->uid)->execute();
706      ->execute();        db_update('node_comment_statistics')->fields(array('last_comment_uid' => 0))->condition('last_comment_uid', $account->uid)->execute();
707    db_update('node_comment_statistics')        break;
708      ->fields(array('last_comment_uid' => 0))  
709      ->condition('last_comment_uid', $user->uid)      case 'user_cancel_reassign':
710      ->execute();        db_update('comment')->fields(array('uid' => 0))->condition('uid', $account->uid)->execute();
711          db_update('node_comment_statistics')->fields(array('last_comment_uid' => 0))->condition('last_comment_uid', $account->uid)->execute();
712          break;
713    
714        case 'user_cancel_delete':
715          module_load_include('inc', 'comment', 'comment.admin');
716          $comments = db_select('comment', 'c')->fields('c', array('cid'))->condition('uid', $account->uid)->execute()->fetchCol();
717          foreach ($comments as $cid) {
718            $comment = comment_load($cid);
719            // Delete the comment and its replies.
720            _comment_delete_thread($comment);
721            _comment_update_node_statistics($comment->nid);
722          }
723          break;
724      }
725  }  }
726    
727  /**  /**

Legend:
Removed from v.1.680  
changed lines
  Added in v.1.681

  ViewVC Help
Powered by ViewVC 1.1.3