Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 03-11-2006, 08:46 PM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Exclude certain forums from "New Posts"

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:

Code:
$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
Reply With Quote
  #2  
Old 03-11-2006, 09:04 PM
Borgs8472 Borgs8472 is offline
 
Join Date: Apr 2004
Posts: 924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^ ^
I wonder if this post would help you.. or it was obvious:
https://vborg.vbsupport.ru/showthread.php?t=105771
Quote:
Originally Posted by Borgs8472
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.ph...40,8&do=getnew

vb3.0 Users use this string to exclude the 3.5 and 2 forums!
https://vborg.vbsupport.ru/search.ph...,112&do=getnew

vb2 Users use this string to exclude the 3.0 and 3.5 forums!
https://vborg.vbsupport.ru/search.ph...,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!
Reply With Quote
  #3  
Old 03-11-2006, 09:13 PM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:

PHP Code:
$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:

PHP Code:
$vbulletin->GPC['exclude'] .= '$arrayname'
Nothing is changed in the search results..
Reply With Quote
  #4  
Old 03-14-2006, 08:25 AM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #5  
Old 03-14-2006, 09:04 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For the benefit of others, an array is not a string.

You need to use implode.
Reply With Quote
  #6  
Old 03-14-2006, 07:41 PM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, sorry, the original query resulted in an array, which I had to convert to a string. Apologies!
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:07 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.04277 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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