MyBB Community Forums

Full Version: How to separate announcements for forum ID on portal page?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, how can I replace code for portal announcements on portal page? To have for example {$announcements2}, {$announcements3}, {$announcements4} etc

Or separate announcements for forum ID on portal page?

Portal announcements are perfect for me but I can't "separate" posts for forum ID. I have all announcements together.
I would like instead have for example all announcements from forum ID 4, all annoucements from forum ID 5 etc and put my variable where I want on the portal page.

Is there a way for make this? Or how can I query only from different forum ID?

The mainly query is this?

$pids = '';
	$tids = '';
	$comma = '';
	$posts = array();
	$attachmentcount = array();
	$query = $db->query("
		SELECT p.pid, p.message, p.tid, p.smilieoff, t.attachmentcount
		FROM ".TABLE_PREFIX."posts p
		LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
		LEFT JOIN ".TABLE_PREFIX."threadfields_data td ON (td.tid=t.tid)
		WHERE t.visible='1'{$annfidswhere}{$tunviewwhere} AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
		ORDER BY t.dateline DESC
		LIMIT {$start}, {$numannouncements}"
	);


{$annfidswhere} is for t.fid IN but even if I put all my forum ID there, I'll have always announcements all together Sad
I think (though it is not very DRY) that you will have to duplicate the announcements query. So each "block" of announcements is unique. I have no idea if that will play well with XThreads though.