From 7df7e2e6ddb37c5ec6a73fcfc474ec4a2b6159e1 Mon Sep 17 00:00:00 2001 From: e107steved <steved@e107.org> Date: Mon, 14 Apr 2008 19:07:02 +0000 Subject: [PATCH] Bug fix in multi-author comment recald --- e107_handlers/comment_class.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index eb5104bb8..abaf8636c 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -12,8 +12,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/comment_class.php,v $ -| $Revision: 1.8 $ -| $Date: 2008-01-12 16:51:43 $ +| $Revision: 1.9 $ +| $Date: 2008-04-14 19:07:02 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -552,25 +552,26 @@ class comment { function recalc_user_comments($id) { - global $sql; + global $sql; - if(is_array($id)) + if(is_array($id)) + { + foreach($id as $_id) { - foreach($id as $_id) - { - $this->recalc_user_comments($_id); - } + $this->recalc_user_comments($_id); } - $qry = " + return; + } + $qry = " SELECT COUNT(*) AS count FROM #comments WHERE SUBSTRING_INDEX(comment_author,'.',1) = '{$id}' "; - if($sql->db_Select_gen($qry)) - { - $row = $sql->db_Fetch(); - $sql->db_Update("user","user_comments = '{$row['count']}' WHERE user_id = '{$id}'"); - } + if($sql->db_Select_gen($qry)) + { + $row = $sql->db_Fetch(); + $sql->db_Update("user","user_comments = '{$row['count']}' WHERE user_id = '{$id}'"); + } } function get_author_list($id, $comment_type)