vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Excluding forum(s) in New Posts (https://vborg.vbsupport.ru/showthread.php?t=223165)

Baldilocks 09-14-2009 01:09 PM

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); 


Lynne 09-14-2009 01: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:
PHP Code:

WHERE forumid NOT IN (''$whereit

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

Baldilocks 09-14-2009 01: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 [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!


All times are GMT. The time now is 12:54 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01629 seconds
  • Memory Usage 1,757KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete