Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 09-14-2009, 02: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, 02: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, 02: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

Thread Tools
Display Modes

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 10:48 PM.


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.03929 seconds
  • Memory Usage 2,215KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete