| 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 |
| 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 |
/** |
/** |