PDA

View Full Version : Excluding forum(s) in New Posts


Baldilocks
09-14-2009, 02:09 PM
How would I change this template so that I can exclude a forum or two?


$how_last = 10; // Wieviel Themen sollen angezeigt werden?

$vbulletin->input->clean_array_gpc('p', array(
'limits'=> TYPE_INT
));

switch($vbulletin->GPC['limits'])
{
case 10:
$max = 10;
;break;
case 20;
$max = 20;
;break;
case 30:
$max = 30;
;break;
default:
$max =& $how_last;
}

$exc = "";
$forumpermissions = array();
foreach($vbulletin->forumcache AS $forum)
{
$forumpermissions[$forum["forumid"]] = fetch_permissions($forum['forumid']);

if ((!($forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview']) AND
!$vbulletin->options['showprivateforums']) OR
!($forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canviewothers']))
{
$exc .= "'" . ',' . "'" . $forum['forumid'];
}
}
unset($forum);
$whereit = ",'$exc'";



$last_threads_sql = $db->query_read_slave("
SELECT
thread.threadid, thread.open, thread.visible, thread.title,
thread.lastpost, thread.forumid, thread.dateline, thread.lastposter
" . (($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid']) ? ", threadread.readtime AS threadread" : "") . "
FROM " . TABLE_PREFIX . "thread AS thread
" . (($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid']) ? " LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")" : "") . "
WHERE forumid NOT IN (''$whereit)
AND thread.open != 10 AND thread.visible = 1
ORDER BY thread.lastpost DESC
LIMIT 0, $max
");

while($last_w = $db->fetch_array($last_threads_sql))
{

if ($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'])
{
$foruminfo['forumreads'] = $vbulletin->forumcache["$last_w[forumid]"]['forumread'];
$lastreads_new = max($foruminfo['forumreads'], TIMENOW - ($vbulletin->options['markinglimit'] * 86400));
}else{
$bbforumviews = intval(fetch_bbarray_cookie('forum_view', $last_w['forumid']));
$lastreads_new = max($bbforumviews, $vbulletin->userinfo['lastvisit']);
}
if (!$lastreads_new)
{
$lastreads_new = $vbulletin->userinfo['lastvisit'];
}

if ($last_w['lastpost'] > $lastreads_new)
{
if ($vbulletin->options['threadmarking'] AND $last_w['threadread'])
{
$threadviews = $last_w['threadread'];
}else{
$threadviews = intval(fetch_bbarray_cookie('thread_lastview', $last_w['threadid']));
}

if ($last_w['lastpost'] > $threadviews)
{
$show['gotonewposts'] = true;
}else{
$show['gotonewposts'] = false;
}
}else{
$show['gotonewposts'] = false;
}

// Optional zu aktivieren // vor $last_w entfernen

//$last_w['date'] = vbdate($vbulletin->options['dateformat'], $last_w['lastpost'], true); //Datum
//$last_w['time'] = vbdate($vbulletin->options['timeformat'], $last_w['lastpost']); //Uhrzeit

$last_class = exec_switch_bg();
$last_w['trimmedtitle'] = fetch_trimmed_title($last_w['title'], $vbulletin->options['lastthreadchars']);
eval('$last_threads .= "' . fetch_template('forumhome_last_threads') . '";');
}
$db->free_result($last_threads_sql);
unset($whereit, $last_threads_sql, $last_w);

Lynne
09-14-2009, 02:46 PM
I would guess this is the line in your plugin (I hope you aren't putting that into a template, because it won't work) you are concerned about:
WHERE forumid NOT IN (''$whereit)

But notice it gets input from a variable, so you could modify the variable also.

Baldilocks
09-14-2009, 02:51 PM
I am trying to modify the code in the Plug-In Manager itself. It displays the "Latest Posts" but I want to exclude threads in a couple of forums.

How would I modify the variable itself?

--------------- Added 1252943841 at 1252943841 ---------------

Nevermind, I just added the two forum id's in between the ' characters. Works like a charm. Thanks for your help!