Log in

View Full Version : Exclude certain forums from "New Posts"


007
03-11-2006, 08:46 PM
I know there are at least two hacks here that let users exclude certain forums from get new posts, but I'm just looking to list a few myself as a plugin.

Basically, I have added a field to the forum table. Let's call this field "getnew" with a default value of 0. 0 Will mean that it is included in get new post results. 1 Will mean it is not.

Then I have a query set like so:

$forums = $db->query_read("SELECT forumid FROM
" . TABLE_PREFIX . "forum AS forum
WHERE getnew=1");

In the search.php file, there are some sections that include:

$vbulletin->GPC['exclude']...etc...

I can use the search_getnew_start hook to add what I need, but I'm not positive on how to set up the second part. I have the initial query, but I need to get it into an array and then have all of forumid's in the array excluded from Get New Posts.

I know it's a simple few lines of code but I'm not familiar with this part of the vB code enough to get it to work. I've been trying different formats with no luck.

If anybody can help out I would appreciate it a lot. :)

~007

Borgs8472
03-11-2006, 09:04 PM
^ ^
I wonder if this post would help you.. or it was obvious:
https://vborg.vbsupport.ru/showthread.php?t=105771
I do love little known elements of vb which don't require serious code knowledge, they're fun.

Remember ages ago when I said look, I don't want to know about the latest [product version] hacks when I do new posts, can't the forums be filtered by usergroup?

Months ago I was told 'wait for the hack database ...' Zzzzz....

So I'm messing around with the search functions and it seems you can craft nice custom strings!

Behold!

vb3.5 Users use this string to exclude the 3.0 and 2 forums!
https://vborg.vbsupport.ru/search.php?exclude=33,34,134,135,99,37,4,5,139,140 ,8&do=getnew

vb3.0 Users use this string to exclude the 3.5 and 2 forums!
https://vborg.vbsupport.ru/search.php?exclude=4,5,139,140,8,155,113,166,108,1 61,110,111,112&do=getnew

vb2 Users use this string to exclude the 3.0 and 3.5 forums!
https://vborg.vbsupport.ru/search.php?exclude=33,34,134,135,99,37,155,113,166 ,108,161,110,111,112&do=getnew

For reference purposes:

3.5 - 155,113,166,108,161,110,111,112
3.0 - 33,34,134,135,99,37
2.0 - 4,5,139,140,8

Obviously if you use them all, that means seeing no hack forums.

I recommend bookmarking your customised newpost string, since it is now handier than the default!

007
03-11-2006, 09:13 PM
Thanks for the link Borgs8472, but I was reading that earlier and that's not what I am trying to do.

I need to figure out how to get this to work dynamically and through queries. I have a lot of forums and the link would be enormous if I went that route you posted. Thanks anyway though. I appreciate the suggestion.

:)

Ok, I am now using this line of code in the search_getnew_start hook:

$vbulletin->GPC['exclude'] .= ',X,X,Z';

Only problem is I can't for the life of me get it to work with my array above. I created a while loop and created a list of forumid's seperated by commas. It echos properly, but when I do this:

$vbulletin->GPC['exclude'] .= '$arrayname';

Nothing is changed in the search results.. :(

007
03-14-2006, 08:25 AM
Does anybody have any ideas? I am at a standstill here and hava tried everything I can thing of. :(

Wouldn't you know my luck.. As soon as I posted again that I can't figure it out I got it to work! :)

Problem solved! :D

merk
03-14-2006, 09:04 AM
For the benefit of others, an array is not a string.

You need to use implode.

007
03-14-2006, 07:41 PM
Ok, sorry, the original query resulted in an array, which I had to convert to a string. Apologies! :D