MyBB Community Forums

Full Version: Add Threads With Most Replies on Sidebar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good Day,

I have done adding Latest Threads on index sidebar by using the portal.php code. Now I can't make it work to add the Threads with Most Replies to my sidebar. I don't want to use plugins for that. Hope you can help me guys thank you! Shy

Also if you can manage to help me also on the Top Poster (5 users only) to show on my index sidebar.

Thank You again Guys! Heart
(2012-11-24, 04:08 AM)harlenjoy Wrote: [ -> ]Good Day,

I have done adding Latest Threads on index sidebar by using the portal.php code. Now I can't make it work to add the Threads with Most Replies to my sidebar. I don't want to use plugins for that. Hope you can help me guys thank you! Shy

Also if you can manage to help me also on the Top Poster (5 users only) to show on my index sidebar.

Thank You again Guys! Heart

At the portal.php file or at whatever mod you are using to pull the latest threads from the portal page find this code

	$altbg = alt_trow();
	$threadlist = '';
	$query = $db->query("
		SELECT t.*, u.username
		FROM ".TABLE_PREFIX."threads t
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
		WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
		ORDER BY t.lastpost DESC 
		LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
	);

And change this part

ORDER BY t.lastpost DESC  

to

 ORDER BY t.replies DESC 

Whereas for the last top 5 posters in the sidebar have a look at my plugin here. It does just that.

http://community.mybb.com/thread-128769.html
Wow great thank you for that! Can I have another question? What is the variable for whose online and forum statistics on portal. Thank You!
(2012-11-24, 09:59 PM)harlenjoy Wrote: [ -> ]Wow great thank you for that! Can I have another question? What is the variable for whose online and forum statistics on portal. Thank You!

You are welcome.

You can see them at the portal template. They are respectively {$whosonline} and {$stats}.
I tried using it copying the portal codes to my index page and use the variables on my sidebar but it is not working. I dunno why. .