vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Exclude certain forums from "New Posts" (https://vborg.vbsupport.ru/showthread.php?t=110106)

007 03-11-2006 08:46 PM

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

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
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!


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:

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.. :(

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


All times are GMT. The time now is 04:05 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.01097 seconds
  • Memory Usage 1,731KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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