vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Blocking final forum post count for some forums (https://vborg.vbsupport.ru/showthread.php?t=56198)

floridaideal 08-14-2003 02:10 PM

Blocking final forum post count for some forums
 
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 03:07 PM

In index.php find:

PHP Code:

// 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:

PHP Code:

// 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 03: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 03:29 PM

Ah yes, the forumid isn't saved along with the posts, try:

PHP Code:

// 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 03: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 03:46 PM

In search.php find around line 558 (of an unhacked 2.3.2 file):

PHP Code:

$wheresql.=" AND thread.open<>10"

replace with:

PHP Code:

$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 04: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 04:25 PM

I'll assume this is the hack you have installed: Since Your Last Visit!

If so, 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]'"); 

Replace with:

PHP Code:

$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 07: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 12:13 PM

PHP Code:

$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 01: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 01:31 PM

Do the same edit as in Post 6 above, but this time its line 592 for an unchacked 2.3.2 it will have:

PHP Code:

// ###################### Start get daily ####################### 

A few lines above it :)

floridaideal 08-15-2003 01: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 02:06 PM

No problem, glad its all working for you :)

floridaideal 08-30-2005 10: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


All times are GMT. The time now is 12:21 AM.

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.01663 seconds
  • Memory Usage 1,767KB
  • 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
  • (9)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)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