MyBB Community Forums

Full Version: Need help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright so I installed this plugin called latest thread, where the title of the latest threads rotate at the top, but I also have two private sections on my forum and i don't want the threads from those sections to show up on it... is there a way to do this?

<?php
/* latest threads to be placed on index page */
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
// Plugin hook
$plugins->add_hook("index_end", "latestthreads");

// Plugin info
function latestthreads_info()
{
return array(
"name" => "latest threads",
"description" => "to add latest threads on index",
"website" => "...",
"author" => "...",
"authorsite" => "...",
"version" => "1.0",
"guid" => "",
"compatibility" => "1*"

);
}
// Run plugin
function latestthreads()
{
global $mybb, $db, $latestthreads;

$max = 10;

$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY tid DESC LIMIT $max");
$latestthreads = '<marquee scrollamount=3>';
while($result = $db->fetch_array($query))
{
$latestthreads .= "&nbsp;<a href=\"showthread.php?tid={$result['tid']}\">".htmlspecialchars_uni($result['subject'])."</a>";
$latestthreads .= "&nbsp; &nbsp;";
}
$latestthreads .= '</marquee>';

return $latestthreads;
}
?>
you can change
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY `tid` DESC LIMIT $max"); 

like below
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads  WHERE `fid` NOT IN(A,B,C ...) ORDER BY `tid` DESC LIMIT $max"); 

A, B, C ... are forum IDs. it can be a single forum ID without comma
Thanks worked perfectly