Top Stats ignoring Global Announcements
Posted: 25 Jul 2012, 18:56
I've noticed that Top Stats isn't updating properly:
Database and Demo for phpBB3 BBCodes, Mods and Smilies
https://phpbb3bbcodes.com/
Code: Select all
// Most viewed topics
if (!empty($config['tsmvt_enable']) && sizeof($flist))
{
$sql = 'SELECT topic_id, forum_id, topic_title, topic_views, topic_time, topic_first_poster_name, topic_first_poster_colour, topic_poster, topic_last_poster_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $flist) . '
ORDER BY topic_views DESC';
$result = $db->sql_query_limit($sql, $config['tsmvt_number']);
while ($row = $db->sql_fetchrow($result))
{
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']);
$view_first_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_poster']);
$view_last_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_last_poster_id']);
$template->assign_block_vars('most_viewed', array(
'TOPIC_ID' => $row['topic_id'],
'FORUM_ID' => $row['forum_id'],
'TOPIC_TITLE' => $row['topic_title'],
'TOPIC_VIEWS' => $row['topic_views'],
'TOPIC_TIME' => $user->format_date($row['topic_time']),
'TOPIC_FIRST_POSTER_NAME' => $row['topic_first_poster_name'],
'TOPIC_FIRST_POSTER_COLOUR' => $row['topic_first_poster_colour'],
'U_FIRST_TOPIC' => $view_topic_url,
'USERNAME_FIRST' => $view_first_poster,
'USERNAME_LAST' => $view_last_poster,
));
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'S_TSMVT_ENABLE' => $config['tsmvt_enable'],
'TSMVT_NUMBER' => $config['tsmvt_number'],
));
}
// Most replied topics
if (!empty($config['tsmrt_enable']) && sizeof($flist))
{
$sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_time, topic_first_poster_name, topic_first_poster_colour, topic_poster, topic_last_poster_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $flist) . '
ORDER BY topic_replies DESC';
$result = $db->sql_query_limit($sql, $config['tsmrt_number']);
while ($row = $db->sql_fetchrow($result))
{
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']);
$view_first_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_poster']);
$view_last_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_last_poster_id']);
$template->assign_block_vars('most_replied', array(
'TOPIC_ID' => $row['topic_id'],
'FORUM_ID' => $row['forum_id'],
'TOPIC_TITLE' => $row['topic_title'],
'TOPIC_REPLIES' => $row['topic_replies'],
'TOPIC_TIME' => $user->format_date($row['topic_time']),
'TOPIC_FIRST_POSTER_NAME' => $row['topic_first_poster_name'],
'TOPIC_FIRST_POSTER_COLOUR' => $row['topic_first_poster_colour'],
'U_FIRST_TOPIC' => $view_topic_url,
'USERNAME_FIRST' => $view_first_poster,
'USERNAME_LAST' => $view_last_poster,
));
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'S_TSMRT_ENABLE' => $config['tsmrt_enable'],
'TSMRT_NUMBER' => $config['tsmrt_number'],
));
}