MyBB Community Forums

Full Version: [Modification] Latest Discussions block on portal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

What I'd like to di is change the Latest Discussions Block so it shows only the Latest Discussions from a specific forum (ie the one I choose in this setting: "the Forum ID to pull announcements from").

Thanks.
in portal.php find:

$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 replace with

$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|%' AND t.fid='THE FORUM ID HERE'
		ORDER BY t.lastpost DESC 
		LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
	);

Replace 'THE FORUM ID HERE' with the actual forum id.

Cheers
Thanks works !
Tweak it a little :

	$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|%' AND t.fid='".$mybb->settings['portal_announcementsfid']."'
        ORDER BY t.lastpost DESC 
        LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
Yep, that should work too as long as you don't have multiple announcement forums Smile

Cheers