vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Exclude forum from New Posts and Today's Posts (https://vborg.vbsupport.ru/showthread.php?t=233594)

Andy 01-19-2010 10:00 PM

Exclude forum from New Posts and Today's Posts
 
1 Attachment(s)
Here is an easy way to exclude forums from New Posts and Today's Posts.

Edit the search.php file.

PHP Code:

function set_newitem_forums($criteria)
{
    global 
$vbulletin;

    
//figure out forums
    //This follows the logic of the original search.  If a forum is specified then use it and its
    //children.  If an include list is specified, then use it without its children.
    //Do not honor the exclude list if we are using the provided forumid
    
if ($vbulletin->GPC['f'])
    {
        
$criteria->add_forumid_filter($vbulletin->GPC['f'], true);
    }
    else
    {
        if (
$vbulletin->GPC['include'])
        {
            
$list explode(','$vbulletin->GPC['include']);

            if (
is_array($list))
            {
                
$list array_map('intval'$list);
                
$criteria->add_forumid_filter($listfalse);
            }
        }
        
        
// start hack
        
$vbulletin->GPC['exclude'] .= ',1,2,3,4';
        
// end hack
        
        
if ($vbulletin->GPC['exclude'])
        {
            
$list explode(','$vbulletin->GPC['exclude']);

            if (
is_array($list))
            {
                
$list array_map('intval'$list);
                
$criteria->add_excludeforumid_filter($list);
            }
        }
    }


Replace the numbers 1,2,4, and 4 with the forum numbers you want to exclude.

beduino 01-20-2010 10:45 AM

Hi Andy
I suppose works to 4.0.1 too?
Tks in advance

GHC Webmaster 01-20-2010 02:00 PM

Quote:

Originally Posted by beduino (Post 1961060)
Hi Andy
I suppose works to 4.0.1 too?
Tks in advance

I tried and yes it does. Now I can at last remove the vBCMSComments thread from these searches.

So thanks indeed.

gsmph 01-23-2010 04:36 PM

i'll try this one out

thanks
tag

br
gsmph

akvaryumforum 02-02-2010 01:14 PM

Is there a way do this just for todays and new messages. When this hack installed that forums are all exculded from searchs. :(

Andy 02-09-2010 03:28 PM

Quote:

Originally Posted by akvaryumforum (Post 1973052)
Is there a way do this just for todays and new messages. When this hack installed that forums are all exculded from searchs. :(

Try this code instead. I haven't tested it but it should work. It would only exclude forums in the New Posts search.

Code:

$foo = $_GET['do'];
if ($foo == 'getnew' OR $foo == 'getdaily') {
  $vbulletin->GPC['exclude'] .= ',1,2,3,4';
}


wolfyman 02-10-2010 07:11 PM

is there a hack that allows members to choose which forums to exclude for themselves?

Paul M 02-10-2010 07:16 PM

Add-ons must be provided as a downloadable file - in this case a text file with the instructions, thanks.

Videx 02-10-2010 11:43 PM

Quote:

Originally Posted by wolfyman (Post 1979382)
is there a hack that allows members to choose which forums to exclude for themselves?

That's easy enough with the default search by adding &exclude=forumnumber1, forumnumber2 . Include works the same way. Of course, they'll probably want to save this search to their browser bar.

wolfyman 02-11-2010 12:35 AM

so... is there a hack that makes it easy for the normal user to do it?

I'm not going to try to explain that to 8000 people lol :)

Videx 02-11-2010 01:20 AM

Quote:

Originally Posted by wolfyman (Post 1979631)
so... is there a hack that makes it easy for the normal user to do it?

Are you imagining a page that lists all your forums with a checkbox beside them and users may check the ones they don't want in their search query? Then they can press a button to get the code to add to their browser bar?

No, I am unaware of such a mod. Seems like an awful lot of trouble to go to just for a few brain-dead people that probably wouldn't use it anyway.

wolfyman 02-11-2010 10:19 AM

investorsiraq.com has it, and the users love it.

Andy 02-13-2010 06:14 AM

Quote:

Originally Posted by wolfyman (Post 1979382)
is there a hack that allows members to choose which forums to exclude for themselves?

I made a a hack that did that on my forum, but only a handful of members used it.

kofoid 02-13-2010 12:15 PM

Where do you make this edit? This would be a smokin' add on with instructions :)

wolfyman 02-13-2010 12:34 PM

Quote:

Originally Posted by Andy (Post 1981205)
I made a a hack that did that on my forum, but only a handful of members used it.

All communities are different, but thank you for your comment. Would you be willing to share your work?

kofoid 02-13-2010 12:48 PM

I found this on vb.com. Super easy.....
http://www.vbulletin.com/forum/showt...+forums+search

Andy 02-13-2010 02:42 PM

Quote:

Originally Posted by wolfyman (Post 1981348)
All communities are different, but thank you for your comment. Would you be willing to share your work?

The code uses an external database so that I don't modify the vBulletin database. It's more works this way but less problematic during upgrades. For this reason it's not something I'm willing to share or support.

New Joe 02-13-2010 03:49 PM

As said, this needs to be a mod for users to be able to do.

Andy 02-13-2010 04:23 PM

One of the problems with allowing the members to exclude the forums they choose is that if they choose lets say a dozen forums, under the breadcrumb where is says "Excluded Forums" becomes very long. To do it right you would want to make the excluded links message a link.

Also some would only want the excluded forums from being displayed when doing a New Posts or Today's Posts and not when using Advanced Search. So to do it right becomes very complex.

burntire 03-13-2010 04:46 AM

Thanks for the code. Installed.

Scalemotorcars 06-02-2010 05:54 AM

Any ideal if this could shut down a cron task? For some reason as soon as I made this change my cron stopped working.

RaSa 06-21-2010 10:44 AM

I like it, but it does not exclude Forums from RSS, right?
But what I need too, is a possibility to exclude Forums from RSS feed.

xug 06-21-2010 11:32 AM

This can be do so much easier ;)

Enter a new replacement variable in your Styles and Template menu :)

Search for Text: do=getnew&

Replace with: do=getnew&exclude=xx,xx,xx

Where xx is the forum you want to exclude :)

VonDoom 08-14-2010 09:34 PM

Quote:

Originally Posted by xug (Post 2056859)
This can be do so much easier ;)

Enter a new replacement variable in your Styles and Template menu :)

Search for Text: do=getnew&

Replace with: do=getnew&exclude=xx,xx,xx

Where xx is the forum you want to exclude :)

+1 Thanks

Bigj85 08-15-2010 01:38 AM

just what I needed thanks ^^^

Trek 08-15-2010 01:58 AM

I use this on my vB4 forum: https://vborg.vbsupport.ru/showthrea...elective+forum

Still works fine, make sure you read the thread though.

Anyway, nicely done and let's people choose for themselves. Also lets the admin choose which forums CANNOT be excluded, etc.

Raptor 03-07-2011 06:58 AM

how about excluding the forums from the sidebar blocks ?

This doesn't affect those

craigvm 05-25-2013 10:12 AM

where do i add that code in the search.php files start or end ?

Mechislav 06-17-2013 01:53 PM

I found it easier to edit Navigation links and to add:
Code:

&exclude='1,2,3,4,5'
or
Code:

&include='6,7,8,9'
nj the links for new or daily posts

dobberhockey 03-18-2014 03:42 AM

Quote:

Originally Posted by Videx (Post 1979643)
Are you imagining a page that lists all your forums with a checkbox beside them and users may check the ones they don't want in their search query? Then they can press a button to get the code to add to their browser bar?

No, I am unaware of such a mod. Seems like an awful lot of trouble to go to just for a few brain-dead people that probably wouldn't use it anyway.

I had it in Vb3 but now in Vb4 I want it. All users are demanding it. It's a large active sports forum and hockey fans don't want to see baseball posts, and vice-versa.

In user settings they would simply highlight the forums they don't want to see, save it, and it's done.

ozzy47 03-18-2014 03:45 AM

Quote:

Originally Posted by wolfyman (Post 1981348)
All communities are different, but thank you for your comment. Would you be willing to share your work?

You do realize you replied to a post that is over 4 years old, and that member has not been on in almost a year. :)

dobberhockey 03-18-2014 03:45 AM

Quote:

Originally Posted by Andy (Post 1981461)
One of the problems with allowing the members to exclude the forums they choose is that if they choose lets say a dozen forums, under the breadcrumb where is says "Excluded Forums" becomes very long. To do it right you would want to make the excluded links message a link.

Also some would only want the excluded forums from being displayed when doing a New Posts or Today's Posts and not when using Advanced Search. So to do it right becomes very complex.

Not an issue with me - hockey fans would just exclude baseball and football, baseball fans would exclude hockey and football, etc.

Videx 03-18-2014 04:14 AM

Quote:

Originally Posted by ozzy47 (Post 2487965)
You do realize you replied to a post that is over 4 years old, and that member has not been on in almost a year. :)

Confusing as all heck. Is it me that hasn't been on for over a year? Then who the heck has been posting as me? :)

ozzy47 03-18-2014 09:53 AM

Never mind me, I just quoted the wrong post, :confused: :)

dknelson 11-30-2014 01:00 PM

Thank you for this. Works perfectly and was much needed.


All times are GMT. The time now is 08:35 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.01754 seconds
  • Memory Usage 1,822KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)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