1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-04 21:44:57 +02:00

[ticket/10497] Fix SQL error when guest visits forum with unread topic

Regression from the ticket PHPBB3-9008 fix.

When topic marking was enabled for guests, and a guest visited a forum with
a new topic which is marked unread, the built SQL missed an alias for a
TOPICS_TABLE which resulted in the following error:

Unknown column 't.topic_approved' in 'where clause' [1054]

The fix is to add an alias for the table.

PHPBB3-10497
PHPBB3-9008
This commit is contained in:
rxu 2011-11-26 01:30:03 +08:00
parent e08e22ca12
commit 77e00d14a1

View File

@ -1943,11 +1943,11 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
}
else
{
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . '
WHERE forum_id = ' . $forum_id . '
AND topic_last_post_time > ' . $mark_time_forum . '
AND topic_moved_id = 0 ' .
$sql = 'SELECT t.topic_id
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_last_post_time > ' . $mark_time_forum . '
AND t.topic_moved_id = 0 ' .
$sql_update_unapproved;
$result = $db->sql_query($sql);