Top Stats ignoring Global Announcements

Download and support for PhpBB3 Top Stats Mod
Locked
User avatar
dazbobaby
BBCoder II
BBCoder II
Posts: 23
Joined: 22 Mar 2010, 02:34

Top Stats ignoring Global Announcements

Post by dazbobaby »

I've noticed that Top Stats isn't updating properly:
Image1.jpg
Image2.jpg
http://www.mess-hall.co.uk/ frank and often adult discussion on PS3 Gaming.
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Top Stats ignoring Global Announcements

Post by Stoker »

This code is from the un-released version:

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'],
    ));
}
Should work with global announcements.
Board rules! No PM support
User avatar
dazbobaby
BBCoder II
BBCoder II
Posts: 23
Joined: 22 Mar 2010, 02:34

Top Stats ignoring Global Announcements

Post by dazbobaby »

Which file is this from Stoker?

got it, functions_top_stats.php
http://www.mess-hall.co.uk/ frank and often adult discussion on PS3 Gaming.
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Top Stats ignoring Global Announcements

Post by Stoker »

yes, the most viewed and most replied part of it.
Board rules! No PM support
Locked