MyBB Community Forums

Full Version: Portal question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to have more than 1 fid's as "announcement forum" in the portal?

I try to look for a mod/plugin but no dice...
Is this what u are looking for ?

http://mods.mybboard.com/tutorials.php?tid=7
does that work on 1.0?? It seems that the code is not the same... :/
portal.php

Find:
$query = $db->query("SELECT COUNT(tid) AS newann FROM ".TABLE_PREFIX."threads WHERE dateline>'".$mybb->user['lastvisit']."' AND fid='".$mybb->settings['portal_announcementsfid']."' $unviewwhere");
Replace with:
$query = $db->query("SELECT COUNT(tid) AS newann FROM ".TABLE_PREFIX."threads WHERE dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$mybb->settings['portal_announcementsfid'].") $unviewwhere");

Find:
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."forums WHERE fid='".$mybb->settings['portal_announcementsfid']."'");
$forum = $db->fetch_array($query);
Replace with:
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."forums WHERE fid IN (".$mybb->settings['portal_announcementsfid'].")");
while($forumrow = $db->fetch_array($query))
{
	$forum[$forumrow['fid']] = $forumrow;
}

Find:
$query = $db->query("SELECT p.pid, p.message, p.tid FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid AND t.dateline=p.dateline) WHERE t.fid='".$mybb->settings['portal_announcementsfid']."' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC LIMIT 0, ".$mybb->settings['portal_numannouncements']);
Replace with:
$query = $db->query("SELECT p.pid, p.message, p.tid FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid AND t.dateline=p.dateline) WHERE t.fid IN (".$mybb->settings['portal_announcementsfid'].") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC LIMIT 0, ".$mybb->settings['portal_numannouncements']);

Find:
$forumpermissions = forum_permissions($mybb->settings['portal_announcementsfid']);
Replace with:
foreach($forum as $fid => $forumrow)
{
	$forumpermissions[$fid] = forum_permissions($fid);
}

Find:
$query = $db->query("SELECT t.*, i.name as iconname, i.path as iconpath, t.username AS threadusername, u.username, u.avatar FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."icons i ON (i.iid = t.icon) LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid) WHERE fid='".$mybb->settings['portal_announcementsfid']."' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC LIMIT 0, ".$mybb->settings['portal_numannouncements']);
Replace with:
$query = $db->query("SELECT t.*, i.name as iconname, i.path as iconpath, t.username AS threadusername, u.username, u.avatar FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."icons i ON (i.iid = t.icon) LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid) WHERE fid IN (".$mybb->settings['portal_announcementsfid'].") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC LIMIT 0, ".$mybb->settings['portal_numannouncements']);

Find:
$forumpermissions['candlattachments']
Replace with:
$forumpermissions[$announcement['fid']]['candlattachments']

Find (the same thing but several lines below):
$forumpermissions['candlattachments']
Replace with:
$forumpermissions[$announcement['fid']]['candlattachments']

Find:
$message = postify($announcement['message'], $forum['allowhtml'], $forum['allowmycode'], $forum['allowsmilies'], $forum['allowimgcode']);
Replace with:
$message = postify($announcement['message'], $forum[$announcement['fid']]['allowhtml'], $forum[$announcement['fid']]['allowmycode'], $forum[$announcement['fid']]['allowsmilies'], $forum[$announcement['fid']]['allowimgcode']);
Dennis, that did the trick... thanks so much...

Just adding that you need to specify the fid's of the forums that you want the portal to take the announcements from separated by a comma...

Eg. 13,24,23 and so on... Big Grin
can i use the same code for the mybb 1.13 too or no ???
I think it's possible in 1.1.3 (I forgot which version I posted the code above for) but it should be the same, if not similar.. I have it running on my forum.