From 4d5ce2dc19da886afbf1d394e63f2542ee4ef5ad Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 19 Oct 2018 10:14:06 +0200 Subject: [PATCH] Fixed forum read checking logic! --- src/Forum/forum.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Forum/forum.php b/src/Forum/forum.php index e0a8aae5..b8b34c15 100644 --- a/src/Forum/forum.php +++ b/src/Forum/forum.php @@ -189,19 +189,16 @@ function forum_read_status_sql( AND %3$s >= NOW() - INTERVAL 1 MONTH AND ( - SELECT COUNT(ti.`topic_id`) < ( - SELECT COUNT(`topic_id`) - FROM `msz_forum_topics` - WHERE `forum_id` = %4$s - AND `topic_bumped` >= NOW() - INTERVAL 1 MONTH - AND `topic_deleted` IS NULL - ) + SELECT COUNT(tt.`topic_id`) FROM `msz_forum_topics_track` as tt RIGHT JOIN `msz_forum_topics` as ti ON ti.`topic_id` = tt.`topic_id` WHERE ti.`forum_id` = %4$s AND tt.`user_id` = %1$s - AND `track_last_read` >= `topic_bumped` + AND ( + tt.`track_last_read` IS NULL + OR tt.`track_last_read` < ti.`topic_bumped` + ) ) ', $user_param,