Thread Rating:
  • 1 Votes - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to display forum names on portal page
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #1
How to display forum names on portal page
I personally find it a nice thing to have (I have this at Endless Paradigm)

To add the forum name, for each portal announcement, just perform the following code edits.

Open up portal.php.
Find:

PHP Code:
1
2
3
4
5
6
7
8
$query = $db->query("
	SELECT t.*, t.username AS threadusername, u.username, u.avatar
	FROM ".TABLE_PREFIX."threads t
	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']
);


Replace with:

PHP Code:
1
2
3
4
5
6
7
8
9
$query = $db->query("
	SELECT t.*, t.username AS threadusername, u.username, u.avatar, f.name AS forumname
	FROM ".TABLE_PREFIX."threads t
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
	LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid = t.fid)
	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']
);


Next, open up your portal_announcement template, and place {$announcement['forumname']} wherever you want it to appear.  You can use {$announcement['fid']} if you need to grab the FID of the forum.

That's it!


My Blog
01-27-2008 01:18 AM
Find all posts by this user

« Next Oldest | Next Newest »

Messages In This Thread
How to display forum names on portal page - ZiNgA BuRgA - 01-27-2008 01:18 AM

 Standard Tools
Forum Jump: