Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Make a forum statistically invisible v.1.0b Details »»
Make a forum statistically invisible v.1.0b
Version: , by gopherhockey gopherhockey is offline
Developer Last Online: Jul 2014 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-09-2003 Last Update: Never Installs: 0
 
No support by the author.

What it does

The idea behind this hack is to take a forum (or forums) and make them statistically invisible to the vb system. Users can still see the forum, read and reply, but activity does not increase post or thread counts for the users or the system itself.

Why?

I can only explain why by giving an example on my own system. In my example, the forum is an NNTP gateway (newsgroup) using the NNTP gateway hack. The forum itself can get anywhere from 0-2000+ posts/threads in a day. Users coming to my system do not wish to see these show up as new posts, new threads etc. I want to treat it as a resource (special) forum - but not let it act like the others by increasing post totals etc.


Lets take this a section at a time

The way vb works, as we all know, is that posts in a forum will trigger various affects. A few of which are:

1. Users post count increases (there is a way around this in the admin cp) No hack needed, just remember to set the forum correctly.

2. Total posts on the entire board go up (as displayed on the top of most unedited vb systems as:

Members: XX, Threads: YY, Posts: ZZ

There are also various scripts & hacks that will show this data on other pages as well, such as vbhome lite which shows it as:


YY new forum threads started
ZZ new forum posts


To not show threads for a specific forum in the total threads for a board, you can open your forum/index.php file and look for:

Code:
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
and replace it with:

Code:
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread WHERE forumid!=XX');
(thanks to Tigga for this solution)

This solves YY, but not ZZ (this is why I'm posting here as I don't have a solution for this part)

4. When looking at the list of all forums, you can see the total number of posts and threads for each forum just before the "Last Post" column.

Post Threads
XXX YYY

I don't know how to turn this on or off either. For my purposes, I'd just as well leave this alone - users can at least see that there are new posts or threads in this resource forum somewhere - might as well be here. For the purposes of this hack, however, it might be nice to know how to turn this on or off.


5. When a user arrives and sees that there are new posts or threads, often times they click on "view new posts" to see a list of what has been posted lately.

Problem here is that they might see hundreds of new posts from this resource forum. I want to exclude this forum from view new posts, so here is how:

(thanks to logician for this answer)

in search.php, find:

Code:
$wheresql.=" AND thread.open<>10";
and replace it with:

Code:
$wheresql.=" AND thread.open<>10 AND thread.forumid!=X";
where X is your forum id.

There are 2 insances of this to find. (one for members, one for guests)

To exclude more than one forum, simply edit the line to look like this:

Code:
$wheresql.=" AND thread.open<>10 AND thread.forumid!=01 AND thread.forumid!=02";

Excluding the forum from the search function:

To keep this resource forum from showing up when a user does a search, you can edit the forum permissions for all user groups and select "no" for the "can search" setting. This requires custom settings for this forum for all groups that you do not wish to search this forum. This is not a hack but a built-in function of vb.


So where are we now?

What have we accomplished thus far is:

1. Our forum won't show new threads to the user
3. Our forum won't increase the users post count in this forum.
3. Our forum won't add to the thread count (display) to the user.
4. Our forum won't show up when a user clicks to view new posts since they last visited.
5. Our forum won't show up when a user does a search

What I haven't been able to do?

Anything related to the post count. Post counts still increase. A user will still see hundreds or thousands of new posts since they last visited. The problem is, with all the edits above they are confused when they see XX posts since they last visited, click on view new posts since last online and get the "sorry, there are no new posts since you last visited" message.

Can anyone provide this missing link?

If so, I *think* I could post this as a semi-hack for those that wish to have this functionality.

(note: I have posted this question elsewhere on this system with no luck, so I'm trying it this way and apologize for the multiple requests)

Thanks for your time...

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-10-2003, 11:57 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by gopherhockey

Anything related to the post count. Post counts still increase. A user will still see hundreds or thousands of new posts since they last visited. The problem is, with all the edits above they are confused when they see XX posts since they last visited, click on view new posts since last online and get the "sorry, there are no new posts since you last visited" message.

Can anyone provide this missing link?
By default vb does not tell user there is XX posts since their last visit so I guess what you are asking is to hack Welcome Panel or a similiar hack that displays this info?

If this is welcome panel hack, the solution that ignores your forum in the query above will work for this hack too. So in index.php find,

PHP Code:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");

$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'"); 
And replace it as:

PHP Code:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]' AND forumid!=X");

$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]' AND forumid!=X"); 
Enjoy..
Reply With Quote
  #3  
Old 03-10-2003, 01:57 PM
gopherhockey's Avatar
gopherhockey gopherhockey is offline
 
Join Date: Jul 2002
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Close, but adding that to a posts query always gives me a SQL error...

One of the displays I run is actually a hack (welcome message on non-vb page) - however, the index.php for vb has the following:

Code:
// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);
This one isn't as critical because people don't really seem to watch it closely, but for the purposes of this hack I'd like to have the stats not show here either.

I've tried doing something similar to your threads solution with your code (for a hack) or something like this (for index.php):

Code:
 $totalposts=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE forumid!=X");
But then I get a SQL error:

Invalid SQL: SELECT count(*) AS posts FROM post WHERE forumid!=50
mysql error: Unknown column 'forumid' in 'where clause'


Actually I wonder if I'm taking the wrong road with this whole thing and should be hitting this from the other side of things.. what I mean is, instead of allowing vb to continue to count posts from this forum and masking them in displays - wouldn't there be a way to just not count them at the time some counter is increased?

I'd be happy either way I guess.. I just always get a SQL error when adding the term forumid!=XX to the post count line(s) regardless of it being a hack or being index.php...
Reply With Quote
  #4  
Old 03-10-2003, 04:36 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My solution will work with new thread count because that table saves forum id for all threads. So adding forumid!=X will work for thread count in welcome panel hack.

However as for post count this solution does not work, because post count is retrieved from posts table and that table does not have any referrence to the forumid of the posts.

A work around might be using this trick:
Hack your gateway hack so that it posts with a special username (a fake username that does not belong to any member but a bot). Then you can exclude it in your query to get accurate results: Eg.

PHP Code:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]' AND forumid!=X");

$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]' AND username!=X"); 
Reply With Quote
  #5  
Old 03-10-2003, 06:14 PM
gopherhockey's Avatar
gopherhockey gopherhockey is offline
 
Join Date: Jul 2002
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey, we're getting closer... at least to solving my gateway, but not the original problem.

I get the following error, however, when using the code you suggested. (all posts from the NNTP gateway are posted under userid "Guest"):



Invalid SQL: SELECT count(*) AS posts FROM post WHERE dateline > '1047312216' AND username!=Guest
mysql error: Unknown column 'Guest' in 'where clause'

Original line:

Code:
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
Updated code that gives error:

Code:
 $getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]' AND username!=Guest");
Is Guest perhaps not a real username, at least in the way other usernames are treated? I'll try another (real) userid, I think it is pretty clear how to do that in the gateway code.
Reply With Quote
  #6  
Old 03-10-2003, 06:35 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
 $getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]' AND username!='Guest'"); 
Reply With Quote
  #7  
Old 03-10-2003, 06:53 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

please notice the ' signs covering username in my last code..
Reply With Quote
  #8  
Old 03-10-2003, 07:37 PM
gopherhockey's Avatar
gopherhockey gopherhockey is offline
 
Join Date: Jul 2002
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea, I posted too quickly and didn't see your answer.

I don't get a SQL query error, however - ignoring "Guest" doesn't seem to work - it still shows new posts from that gateway.

If I use an ID that is an actual user on the system, however, it works... so now I just need to find out from the author of that hack how to change the userid it uses when posting...

Thx.
Reply With Quote
  #9  
Old 03-10-2003, 07:59 PM
gopherhockey's Avatar
gopherhockey gopherhockey is offline
 
Join Date: Jul 2002
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did it... you use the userid instead of username...

To ignore posts totals from the guest user, simply edit your index.php and change:

Code:
 $countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
to:

Code:
 $countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post WHERE userid!=0');

If you run a script such as webwelcome where it picks out the number of posts since the user last logged in, just find the line:

Code:
 $getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
and change to:

Code:
 $getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]' AND userid!=0");

HOWEVER - this doesn't solve my initial issue, making a forum transparent. Apparently since the forumid is not logged to the posts table, this might be impossible unless we add a column to the table such as "ignoreforum" and set it to 1 or 0 when posting items for that forum. Then we could look for ignoreforum!=1 and it would probably work.

Problem is, I don't know enough to do that.. but I'll keep looking. I know in my original case the NNTP gateway hack did add an "isnntpgateway" column which I could have used. If I can figure out how it is setting this, I can probably complete this "hack" (so to speak)
Reply With Quote
  #10  
Old 10-03-2003, 01:07 PM
Dan_UPC Dan_UPC is offline
 
Join Date: Dec 2002
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gopherhockey
HOWEVER - this doesn't solve my initial issue, making a forum transparent. Apparently since the forumid is not logged to the posts table, this might be impossible unless we add a column to the table such as "ignoreforum" and set it to 1 or 0 when posting items for that forum. Then we could look for ignoreforum!=1 and it would probably work.
To ignore posts (from a particular forum) on index.php this should work ...

$totalposts=$DB_site->query_first("SELECT count(*) AS posts FROM post, thread WHERE post.threadid=thread.threadid AND thread.forumid!=X");

I think it will probably do a full table scan of the thread table but it does work.
Reply With Quote
Reply


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:55 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.04261 seconds
  • Memory Usage 2,324KB
  • Queries Executed 23 (?)
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
  • (13)bbcode_code
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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_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