Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2009, 01:09 PM
Baldilocks's Avatar
Baldilocks Baldilocks is offline
 
Join Date: Jan 2008
Location: Delaware, USA
Posts: 297
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Excluding forum(s) in New Posts

How would I change this template so that I can exclude a forum or two?

PHP Code:
$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); 
Reply With Quote
  #2  
Old 09-14-2009, 01:46 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
PHP Code:
WHERE forumid NOT IN (''$whereit) 
But notice it gets input from a variable, so you could modify the variable also.
Reply With Quote
  #3  
Old 09-14-2009, 01:51 PM
Baldilocks's Avatar
Baldilocks Baldilocks is offline
 
Join Date: Jan 2008
Location: Delaware, USA
Posts: 297
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 [DATE]1252943841[/DATE] at [TIME]1252943841[/TIME] ---------------

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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:44 AM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.