From bf22ca024a0565643b70dd3eb381559a5d44a3af Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 2 Jun 2010 06:20:11 +0000 Subject: - Patch #814884 by catch: comment_user_cancel() should use comment_save(). --- modules/comment/comment.module | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'modules/comment') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index d103e3a2d..2143e49e8 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1323,25 +1323,19 @@ function comment_node_search_result($node) { 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(); + $comments = comment_load_multiple(array(), array('uid' => $account->uid)); + foreach ($comments as $comment) { + $comment->status = 0; + comment_save($comment); + } 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(); + $comments = comment_load_multiple(array(), array('uid' => $account->uid)); + foreach ($comments as $comment) { + $comment->uid = 0; + comment_save($comment); + } break; } } -- cgit v1.2.3