MyBB Community Forums
[How To?] How to separate announcements for forum ID on portal page? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: [How To?] How to separate announcements for forum ID on portal page? (/thread-167579.html)



How to separate announcements for forum ID on portal page? - niere8 - 2015-02-22

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


RE: How to separate announcements for forum ID on portal page? - Leefish - 2015-02-22

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.