MyBB Community Forums

Full Version: Seperate Announcements
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This one courtesy of MakPaolo...

You ever find it confusing whenever you have multiple announcements in one forum and you click one of the announcements and the rest of them are displayed one after another? Well, here this modification can help you have only just one announcement displayed on it's own thread.

-- [ OPEN ] --

announcements.php

-- [ FIND ] --
Quote:$query = $db->query("SELECT u.*, u.username, a.*, f.*, g.title AS grouptitle, g.usertitle AS groupusertitle, g.stars AS groupstars, g.starimage AS groupstarimage, g.image AS groupimage, g.namestyle, g.usereputationsystem FROM ".TABLE_PREFIX."announcements a LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid) LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid) LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE a.startdate<='$time' AND a.enddate>='$time' AND ($sql OR fid='-1') ORDER BY a.startdate DESC");
-- [ REPLACE WITH ] --
Quote:$query = $db->query("SELECT u.*, u.username, a.*, f.*, g.title AS grouptitle, g.usertitle AS groupusertitle, g.stars AS groupstars, g.starimage AS groupstarimage, g.image AS groupimage, g.namestyle, g.usereputationsystem FROM ".TABLE_PREFIX."announcements a LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid) LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid) LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE a.startdate<='$time' AND a.enddate>='$time' AND ($sql OR fid='-1') AND aid='$aid' ORDER BY a.startdate DESC");
-- [ EDIT ] --

forumdisplay_announcements (found at the admin cp on the templates section)

-- [ FIND ] --
Quote: <a href="announcements.php?fid=$fid">
-- [ REPLACE WITH ] --
Quote: <a href="announcements.php?fid=$fid&aid=$announcement[aid]">
And while your at it Smile

This will make shure, that all announcements are displayed seperatly in the forums (limit can be set in the admin CP settings).

-- [ OPEN ] --

forumdisplay.php

-- [ FIND ] --
$time = time();
$query = $db->query("SELECT a.*, u.username FROM ".TABLE_PREFIX."announcements a LEFT JOIN ".TABLE_PREFIX."users u ON u.uid=a.uid WHERE a.startdate<='$time' AND a.enddate>='$time' AND ($sql OR fid='-1') ORDER BY a.startdate DESC $limit");
$announcement = $db->fetch_array($query);
if($announcement['aid'])

-- [ REPLACE WITH ] --
$time = time();
$query = $db->query("SELECT a.*, u.username FROM ".TABLE_PREFIX."announcements a LEFT JOIN ".TABLE_PREFIX."users u ON u.uid=a.uid WHERE a.startdate<='$time' AND a.enddate>='$time' AND ($sql OR fid='-1') ORDER BY a.startdate DESC $limit");
while($announcement = $db->fetch_array($query))
{
	if($announcement['aid'])

-- [ FIND ] --
	else
	{
		$bgcolor = "trow2";
	}
}

-- [ REPLACE WITH ] --
		else
		{
			$bgcolor = "trow2";
		}
	}
}
What do you mean? It shows them seperately when viewing them the index of a forum. Could you provide a screenshot, not really sure what you are intending to do with this.
Shure.

If you look carefully, you will see 2 "Mededeling" (announcements in dutch Smile )

Normall:
- One announcement (when viewing the forums)
- When entering, all announcement

With the mod you supplied in your topic:
- One announcement (when viewing the forums)
- When entering, one announcement

With the mod you supplied in your topic + my mod:
- All announcement (within the limit) (when viewing the forums)
- When entering, one announcement

Got it?
Thanks - the both modifications made MyBB "more like other BBs"... I did'nt liked the way the MyBB shows Announcements so much - now all seems perfect Smile