Hi and thanks for your reply.
I should have posted the entire code to make sure the addition fits in. I tried to add the statement(s) below and it failed

My fault for not knowing where to add the code.
Here's the entire section
PHP Code:
$number = $vbulletin->options[latest_x_threads_number];
foreach ($vbulletin->userinfo['forumpermissions'] AS $forumid => $fperms)
{
if (!($fperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($fperms & $vbulletin->bf_ugp_forumpermissions['cansearch']) OR !verify_forum_password($forumid, $forum['password'], false) OR !($vbulletin->forumcache[$forumid]['options'] & $vbulletin->bf_misc_forumoptions['indexposts']))
{
$excludelist .= ",$forumid";
}
else if ((!$vbulletin->GPC['titleonly'] OR $vbulletin->GPC['showposts']) AND !($fperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']))
{ // exclude forums that have canview but no canviewthreads if this is a post search
$excludelist .= ",$forumid";
}
}
if($excludelist != ''){
$excludedthreads = "WHERE forum.forumid NOT IN (0$excludelist)";
}
$latestthreads = $db->query_read("
SELECT thread.*, thread.open AS open, forum.title as forumname, forum.forumid as forumid, icon.iconpath AS iconpath, icon.iconid,
IF (thread.iconid=0, 'images/icons/icon1.gif', icon.iconpath)as icon
FROM " . TABLE_PREFIX . "thread as thread
LEFT JOIN " . TABLE_PREFIX . "forum as forum ON (forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "icon as icon ON (icon.iconid = thread.iconid)
$excludedthreads
ORDER BY thread.lastpost DESC
LIMIT 0,$number
");
while ($thread = $db->fetch_array($latestthreads))
{
if ($thread['replycount'] >= $vbulletin->options['hotnumberposts'] OR $thread['views'] >= $vbulletin->options['hotnumberviews'])
{
$thread['statusicon'] = "_hot_new";
}
if ($thread['open'] == '0')
{
$thread['statusicon'] = "_lock";
if ($thread['replycount'] >= $vbulletin->options['hotnumberposts'] OR $thread['views'] >= $vbulletin->options['hotnumberviews'])
{
$thread['statusicon'] = "_hot_lock";
}
}
eval('$latest_x_threads_bits .= "' . fetch_template('latest_x_threads_bits') . '";');
}
eval('$latest_x_threads = "' . fetch_template('latest_x_threads') . '";');