MyBB Community Forums

Full Version: Latest Threads Sidebar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,

I was wondering if there was anyway to code (in PHP, I'm guessing) a way for a sidebar that pulls the Latest Threads to ignore certain forums ids?

This is the code that my plugin is using to pull the latest threads:
//Get latest threads
	if($mybb->settings['sb_latest'] == 1)
	{
		$altbg = alt_trow();
		$threadlist = '';
		$query = $db->query("
			SELECT t.*, u.username
			FROM ".TABLE_PREFIX."threads t
			LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
			WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
			ORDER BY t.lastpost DESC 
			LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
		);
		while($thread = $db->fetch_array($query))
		{
			$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
			$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
			// Don't link to guest's profiles (they have no profile).
			if($thread['lastposteruid'] == 0)
			{
				$lastposterlink = $thread['lastposter'];
			}
			else
			{
				$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
			}
			if(my_strlen($thread['subject']) > 25)
			{
				$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
			}
			$thread['subject'] = htmlspecialchars_uni($thread['subject']);
			$thread['threadlink'] = get_thread_link($thread['tid']);
			eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
			$altbg = alt_trow();
		}
		if($threadlist)
		{ // show the table only if there are threads
			eval("\$sb_latestthreads = \"".$templates->get("portal_latestthreads")."\";");
		}
	}


Any help would be great!
BUMP! (If I'm allowed) Big Grin
$var1 =xx;

xx is the forum ID.

 WHERE fid != ".$var1." 

Something like that.
Hello. I would like to use this script on my forum but i would use a mybb sidebar mod and then insert this code as PHP but i need to know how i would use this script for multiple threads/categorys.

That would be great.