mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
Further adjust unread tracking query, should work now for user last mark times less than forum/topic mark times.
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10121 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -1683,6 +1683,8 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
|
||||
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
||||
{
|
||||
// Get list of the unread topics
|
||||
$last_mark = $user->data['user_lastmark'];
|
||||
|
||||
$sql_array = array(
|
||||
'SELECT' => 't.topic_id, t.topic_last_post_time, tt.mark_time as topic_mark_time, ft.mark_time as forum_mark_time',
|
||||
|
||||
@@ -1691,16 +1693,23 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
|
||||
'LEFT_JOIN' => array(
|
||||
array(
|
||||
'FROM' => array(TOPICS_TRACK_TABLE => 'tt'),
|
||||
'ON' => 't.topic_id = tt.topic_id AND t.topic_last_post_time > tt.mark_time AND tt.user_id = ' . $user_id,
|
||||
'ON' => "tt.user_id = $user_id AND t.topic_id = tt.topic_id AND tt.mark_time > $last_mark",
|
||||
),
|
||||
array(
|
||||
'FROM' => array(FORUMS_TRACK_TABLE => 'ft'),
|
||||
'ON' => 't.forum_id = ft.forum_id AND t.topic_last_post_time > ft.mark_time AND ft.user_id = ' . $user_id,
|
||||
'ON' => "ft.user_id = $user_id AND t.forum_id = ft.forum_id AND ft.mark_time > $last_mark",
|
||||
),
|
||||
),
|
||||
|
||||
'WHERE' => "((tt.topic_id OR ft.forum_id)
|
||||
OR t.topic_last_post_time > {$user->data['user_lastmark']})
|
||||
'WHERE' => "
|
||||
(
|
||||
(tt.mark_time AND t.topic_last_post_time > tt.mark_time) OR
|
||||
(tt.mark_time IS NULL AND ft.mark_time AND t.topic_last_post_time > ft.mark_time) OR
|
||||
(
|
||||
((tt.mark_time IS NULL AND ft.mark_time IS NULL) OR (tt.mark_time < $last_mark AND ft.mark_time < $last_mark))
|
||||
AND t.topic_last_post_time > $last_mark
|
||||
)
|
||||
)
|
||||
$sql_extra
|
||||
$sql_sort",
|
||||
);
|
||||
@@ -1711,8 +1720,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$topic_id = (int) $row['topic_id'];
|
||||
|
||||
$unread_topics[$topic_id] = ($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : (int) $row['topic_mark_time'];
|
||||
$unread_topics[$topic_id] = ($row['topic_mark_time']) ? (int) $row['topic_mark_time'] : (($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : $last_mark);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user