Can't think of a better place to ask this, so here it goes.
What I have is a forum section with several subforums that are populated using the RSS feed system in VB. People want to be able to see these forums, but because of the number of threads, they don't want them showing up in the search results for unread posts. So using the new version of the Unread Posts mod in conjunction with the Selective Forum Filter won't work because that would prevent them from seeing the subforums at all.
The code below is from the Unread Posts mod version I have installed (version 1.02). So what I am hoping is that it might be a simple case of just adding a conditional or something to the PHP code to force the exclusion of those subforums from the search all the time. The problem is I don't know squat about coding in PHP. Can someone please indicate what I would have to add/change to accomplish this?
Code:
$unread = "";
if ($vbulletin->userinfo['userid'] AND $vbulletin->options['threadmarking'])
{
$unread = "No unread posts";
$xforum_ids = array_keys($vbulletin->forumcache);
foreach ($xforum_ids AS $key => $xforum_id)
{
$xfperms = & $vbulletin->userinfo['forumpermissions']["$xforum_id"];
$xforum = & $vbulletin->forumcache["$xforum_id"];
if ( !($xfperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($xfperms & $vbulletin->bf_ugp_forumpermissions['cansearch']))
{
unset($xforum_ids["$key"]);
}
}
if (empty($xforum_ids))
{
$xforum_list = "0";
}
else
{
$xforum_list = implode(', ', $xforum_ids);
}
if ($vbulletin->options['unreadlv'])
{
$cutoff = $vbulletin->userinfo['lastvisit'];
}
else
{
$cutoff = TIMENOW - ($vbulletin->options['markinglimit'] * 86400);
}
$postcount = $vbulletin->db->query_first("
SELECT COUNT(post.postid) as unread
FROM " . TABLE_PREFIX . "post as post
INNER JOIN " . TABLE_PREFIX . "thread as thread ON (thread.threadid = post.threadid)
LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")
INNER JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "forumread AS forumread ON (forumread.forumid = forum.forumid AND forumread.userid = " . $vbulletin->userinfo['userid'] . ")
WHERE thread.forumid IN($xforum_list)
AND thread.sticky IN (0,1) AND thread.visible IN (0,1,2)
AND thread.lastpost > IF(threadread.readtime IS NULL, $cutoff, threadread.readtime)
AND thread.lastpost > IF(forumread.readtime IS NULL, $cutoff, forumread.readtime)
AND thread.lastpost > $cutoff
AND post.dateline > IF(threadread.readtime IS NULL, $cutoff, threadread.readtime)
AND post.dateline > IF(forumread.readtime IS NULL, $cutoff, forumread.readtime)
AND post.dateline > $cutoff
");
if ($postcount['unread'])
{
if ($postcount['unread'] == 1)
{
$unread = "1 Unread Post";
}
else
{
$unread = $postcount['unread']." Unread Posts";
}
}
if ($vbulletin->options['unreadlv'])
{
$unread = "<a href='/forums/search.php?do=getnew'><b>" . $unread . "</b></a> since your last visit.<br />";
}
else
{
$unread = "You have <a href='/forums/search.php?do=getnew'><b>" . $unread . "</b></a><br />";
}
$search_text = '</strong><br />';
$vbulletin->templatecache['navbar'] = str_replace($search_text,$search_text.$unread,$vbulletin->templatecache['navbar']);
}
Thanks.