View Full Version : Blocking final forum post count for some forums
floridaideal
08-14-2003, 03:10 PM
Hello all
Can anyone please tell me if there is a way of stopping one forums posts counting towards the final forum post count at the top of the screen?
i.e I have just installed the newsgroup hack so I now have 2 extra forums with 3000 new posts BUT I worked hard for the original 50,000 posts that helped build my forum so I feel I am cheating a little.
I know there is a way to stop it counting towards users posts but I would like to block the forum from counting either of the 2 I just added and count the rest as per normal.
I hope someone understands me ! :confused:
Thank you
Stuart
NTLDR
08-14-2003, 04:07 PM
In index.php find:
// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=number_format($countthreads['threads']);
Replace with:
// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post WHERE forumid NOT IN(1,2,3)');
$totalposts=number_format($countposts['posts']);
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread WHERE forumid NOT IN(1,2,3)');
$totalthreads=number_format($countthreads['threads']);
Change 1,2,3 to the forumids of the newgroup forums eg 23,45 or 556,23,67,56.
Untested but should work.
floridaideal
08-14-2003, 04:19 PM
Hi NTLDR
Thank you for your hack thats very kind of you, only I get a database error when I install it? Any ideas please? Thank you again.
Database error in vBulletin 2.2.8:
Invalid SQL: SELECT COUNT(*) AS posts FROM post WHERE forumid NOT IN(127,128)
mysql error: Unknown column 'forumid' in 'where clause'
mysql error number: 1054
NTLDR
08-14-2003, 04:29 PM
Ah yes, the forumid isn't saved along with the posts, try:
// get total posts
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads, SUM(replycount) AS posts FROM thread WHERE forumid NOT IN(1,2,3)');
$totalthreads=number_format($countthreads['threads']);
$totalposts=number_format($countthreads['posts']+$countthreads['threads']);
Again, untested, but this time should work ;)
floridaideal
08-14-2003, 04:40 PM
Your the man Lee, thank you for that works like a dream!
Wouldnt happen to know how I can stop these posts appearing in the "view new posts" now would you?
Thank you
Stuart
NTLDR
08-14-2003, 04:46 PM
In search.php find around line 558 (of an unhacked 2.3.2 file):
$wheresql.=" AND thread.open<>10";
replace with:
$wheresql.=" AND thread.open<>10";
$wheresql.=" AND thread.forumid NOT IN(1,2,3)";
Again untested but should work for you :)
floridaideal
08-14-2003, 05:12 PM
Hi Lee
Wonderful thank you, sorry to keep bugging you but is there anyway the number posts since your last visit can also be changed to ignore these 2 forums? Don't want to upset my members and have them asking why the view new posts isnt working.
Thanks again Lee, your a gent!
Stuart
NTLDR
08-14-2003, 05:25 PM
I'll assume this is the hack you have installed: Since Your Last Visit! (https://vborg.vbsupport.ru/showthread.php?s=&threadid=31957&highlight=posts+since+last+visit)
If so, find:
$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]'");
Replace with:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]' AND forumid NOT IN(1,2,3)");
$getnewpost=$DB_site->query_first("SELECT COUNT(*) AS posts FROM post LEFT JOIN thread USING (threadid) WHERE dateline > '$bbuserinfo[lastvisit]' AND thread.forumid NOT IN(1,2,3)");
The new post query isn't very optimised, but I can't think of any other way of doing it, but it does work. Remember to changes the forumids again ;)
floridaideal
08-15-2003, 08:00 AM
Hello again
Sorry for the delay in replying and thank you so much for your help!
I installed the hack you last posted but am getting a sql errror:
Invalid SQL: SELECT COUNT(*) AS posts FROM post LEFT JOIN thread USING (threadid) WHERE dateline > '1060933721' AND thread.forumid NOT IN(127,128)
mysql error: Column: 'dateline' in where clause is ambiguous
mysql error number: 1052
Any ideas?
Thank you
Stuart
NTLDR
08-15-2003, 01:13 PM
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]' AND forumid NOT IN(1,2,3)");
$getnewpost=$DB_site->query_first("SELECT COUNT(*) AS posts FROM post LEFT JOIN thread USING (threadid) WHERE post.dateline > '$bbuserinfo[lastvisit]' AND thread.forumid NOT IN(1,2,3)");
Sorry, a small error in the second query, use the above code instead I'm positive that will work, but I haven't got a vB2 set up hence why I haven't tested any of this :)
floridaideal
08-15-2003, 02:18 PM
Wow that is great, thank you sooooooo much, thats worked perfectly!
OK I know this is sooooooo cheaky but can I ask one more favour?
A few months ago I installed a simple hack that allowed users to view the last 24hrs posts and I conected upto a text link called "View Recent Threads" and this links too "forum/search.php?action=getdaily&days=# " and lists all the posts over the last 24hrs, and of course this also lists the hundreds of newsgroups posts also which is a pain, anyway that I can stop the posts being listed here again please?
This is the last problem that needs solving honest!
Thank you thank you
Stuart
PS: Just seen "Freddy Vs Jason" which is a great film, go see it all!
NTLDR
08-15-2003, 02:31 PM
Do the same edit as in Post 6 (https://vborg.vbsupport.ru/showthread.php?postid=425993#post425993) above, but this time its line 592 for an unchacked 2.3.2 it will have:
// ###################### Start get daily #######################
A few lines above it :)
floridaideal
08-15-2003, 02:50 PM
Lee, thank you so so much , this has worked a treat, from one UK'er to another , cheers mate :)
NTLDR
08-15-2003, 03:06 PM
No problem, glad its all working for you :)
floridaideal
08-30-2005, 11:27 AM
Hello
I could really do with using this hack again on my VB3.08 forum if someone could possible tell me where to look please?
Would appricate any help.
NTLDR, If your still about I could really use your help.
Thank you
Stu
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.