From 0afb9e67bf5282e9e7215e52b0787e2e5de85846 Mon Sep 17 00:00:00 2001 From: Achim Ennenbach Date: Thu, 9 Aug 2018 14:52:17 +0200 Subject: [PATCH] fixes #3269 switched v1 tables to v2 Fixed issue with null values in table (on duplicate) --- e107_plugins/forum/forum_class.php | 2 +- top.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index 1ee6c4606..47b1751a9 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -796,7 +796,7 @@ class e107forum $qry = ' INSERT INTO `#user_extended` (user_extended_id, user_plugin_forum_posts) VALUES ('.USERID.', 1) - ON DUPLICATE KEY UPDATE user_plugin_forum_posts = user_plugin_forum_posts + 1 + ON DUPLICATE KEY UPDATE user_plugin_forum_posts = IFNULL(user_plugin_forum_posts, 0) + 1 '; $result = $sql->gen($qry); } diff --git a/top.php b/top.php index 830c39927..8393afdd5 100644 --- a/top.php +++ b/top.php @@ -193,7 +193,8 @@ if ($action == 'top') $text .= "\n"; if ($subaction == 'forum') { - $ftotal = $sql->db_Count('user', '(*)', 'WHERE `user_forums` > 0'); + //$ftotal = $sql->db_Count('user', '(*)', 'WHERE `user_forums` > 0'); + $ftotal = $sql->count('user_extended', '(*)', 'WHERE `user_plugin_forum_posts` > 0'); $parms = "{$ftotal},{$view},{$from},".e_SELF.'?[FROM].top.forum.'.$view; $text .= "
".$tp->parseTemplate("{NEXTPREV={$parms}}").'
'; }