PDA

View Full Version : Miscellaneous Hacks - Exclude forum from New Posts and Today's Posts


Andy
01-19-2010, 10:00 PM
Here is an easy way to exclude forums from New Posts and Today's Posts.

Edit the search.php file.


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($list, false);
}
}

// 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
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
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.


$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
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
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
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
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/showthread.php?334699-How-to-exclude-forums-from-the-quot-WHAT-S-NEW-quot-link-in-the-nav-bar&highlight=exclude+forums+search

Andy
02-13-2010, 02:42 PM
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
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/showthread.php?t=215001&highlight=selective+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:
&exclude='1,2,3,4,5'
or
&include='6,7,8,9'
nj the links for new or daily posts

dobberhockey
03-18-2014, 03:42 AM
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
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
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
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.