From bf5e5c1293601510a78d89858d34b077082c331b Mon Sep 17 00:00:00 2001 From: Tijn Kuyper Date: Wed, 2 Oct 2019 15:15:31 +0200 Subject: [PATCH] Fixes #1706 - Update user_comments when deleting comments from comment manager --- e107_admin/comment.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/e107_admin/comment.php b/e107_admin/comment.php index d0a2b1b76..45f072268 100644 --- a/e107_admin/comment.php +++ b/e107_admin/comment.php @@ -175,6 +175,12 @@ class comments_admin_ui extends e_admin_ui { $sql = e107::getDb(); + // Update 'user_comments' column in #user table + if(!$sql->update('user', 'user_comments = user_comments - 1 WHERE user_id='.$deleted_data['comment_author_id'])) + { + e107::getMessage()->addError(LAN_DELETED_FAILED)->render(); + } + switch ($deleted_data['comment_type']) { case '0' : @@ -182,6 +188,8 @@ class comments_admin_ui extends e_admin_ui $sql->update('news', 'news_comment_total = CAST(GREATEST(CAST(news_comment_total AS SIGNED) - 1, 0) AS UNSIGNED) WHERE news_id='.$deleted_data['comment_item_id']); break; } + + }