aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-05-19 15:24:49 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-05-19 15:24:49 +0000
commitd725a8faf1495dd462e4a119176fc4b517969859 (patch)
treeb6ff6798099864efc62bbd1553ebae42991a8570 /phpBB/viewtopic.php
parentf0964d4a43a03b8b22b2a9baaffe128014a931b2 (diff)
downloadforums-d725a8faf1495dd462e4a119176fc4b517969859.tar
forums-d725a8faf1495dd462e4a119176fc4b517969859.tar.gz
forums-d725a8faf1495dd462e4a119176fc4b517969859.tar.bz2
forums-d725a8faf1495dd462e4a119176fc4b517969859.tar.xz
forums-d725a8faf1495dd462e4a119176fc4b517969859.zip
Jump to last post on "View newest unread" when all posts have been read
git-svn-id: file:///svn/phpbb/trunk@4021 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index d0084dd9bb..52941fdb9a 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -74,12 +74,14 @@ if (isset($_GET['view']) && !$post_id)
$sql_unread_time = (!empty($tracking_topics[$topic_id])) ? $tracking_topics[$topic_id] : 0;
}
- $sql = "SELECT p.post_id
- FROM (" . POSTS_TABLE . " p
- $sql_lastread)
- WHERE p.topic_id = $topic_id
+ $sql = 'SELECT p.post_id
+ FROM (' . POSTS_TABLE . " p
+ $sql_lastread, " . TOPICS_TABLE . " t)
+ WHERE t.topic_id = $topic_id
+ AND p.topic_id = t.topic_id
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1') . "
- AND (p.post_time >= $sql_unread_time)
+ AND (p.post_time >= $sql_unread_time
+ OR p.post_id = t.topic_last_post_id)
ORDER BY p.post_time ASC";
$result = $db->sql_query_limit($sql, 1);