Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-14-2003, 03:10 PM
floridaideal floridaideal is offline
 
Join Date: Aug 2002
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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 !

Thank you

Stuart
Reply With Quote
  #2  
Old 08-14-2003, 04:07 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 08-14-2003, 04:19 PM
floridaideal floridaideal is offline
 
Join Date: Aug 2002
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 08-14-2003, 04:29 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 08-14-2003, 04:40 PM
floridaideal floridaideal is offline
 
Join Date: Aug 2002
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 08-14-2003, 04:46 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 08-14-2003, 05:12 PM
floridaideal floridaideal is offline
 
Join Date: Aug 2002
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 08-14-2003, 05:25 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 08-15-2003, 08:00 AM
floridaideal floridaideal is offline
 
Join Date: Aug 2002
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 08-15-2003, 01:13 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
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 12:57 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.04532 seconds
  • Memory Usage 2,276KB
  • Queries Executed 11 (?)
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
  • (8)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete