Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-08-2002, 09:18 AM
jamie jamie is offline
 
Join Date: Oct 2001
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default hack to show the total posts/threads ever not just the totals in the database now?

hello,

proably a simple thing but on my board lots of threads have been pruned. So on the forum home page is there anyway to show the total posts/threads ever posted not just the totals in the database now?

just so we don't miss out on the 500'000th post
Reply With Quote
  #2  
Old 05-08-2002, 12:14 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In index.php, changing the line:
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');

to:

$countposts=$DB_site->query_first('SELECT postid AS posts FROM post ORDER BY postid DESC LIMIT 1' );

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

to:

$countthreads=$DB_site->query_first('SELECT threadid AS threads FROM thread ORDER BY threadid DESC LIMIT 1');

should do the trick!

Enjoy! \\=^))
Logician
Reply With Quote
  #3  
Old 05-09-2002, 03:54 AM
SFishy SFishy is offline
 
Join Date: Nov 2001
Location: NY
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What if you already pruned and did the damage? How can you restore the count?

Ideas?

Thanks!
Reply With Quote
  #4  
Old 05-09-2002, 05:51 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@sFishy: The code above works and reliable even if you delete ALL records in your WHOLE database..

The logic that lies behind is that:

Your database tables give an id number to all records while saving them. This unique id number will be increased by 1 with every new record and since it's unique, even if you delete the record, same id # will never be assigned to a new record.

The original vbulletin code above counts the existing (undeleted) database records while calculating the message and threads numbers. However my code checks what the largest id number is in the table. If, say, it returns 4567, you are very likely to have less messages in your database, since some can be deleted in the past, but you can be sure that from day one to today, you created exactly 4567 threads whether some deleted or some exists.

See?

Regards,
Logician
Reply With Quote
  #5  
Old 05-09-2002, 07:09 AM
RDX1 RDX1 is offline
 
Join Date: Apr 2002
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any way so it can be like this

Threads: XXX | Posts: xxx | Total Posts: XXX
Reply With Quote
  #6  
Old 05-09-2002, 08:36 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 NerdNations
any way so it can be like this

Threads: XXX | Posts: xxx | Total Posts: XXX
Sure, why not:

Leave the original code as it is and add these 2 lines after them:

$count_maxx_posts=$DB_site->query_first('SELECT postid AS posts FROM post ORDER BY postid DESC LIMIT 1' );

$count_maxx_threads=$DB_site->query_first('SELECT threadid AS threads FROM thread ORDER BY threadid DESC LIMIT 1');

Now you can change your main page template and use these 2 variables $count_maxx_posts and $count_maxx_threads in anywhere or in any way you like..

Logician
Reply With Quote
  #7  
Old 05-09-2002, 09:30 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Logician: Just use [minicode]MAX(postid) AS maxpostid[/minicode], no need for the [minicode]ORDER BY[/minicode] and [minicode]LIMIT[/minicode].
Reply With Quote
  #8  
Old 05-21-2002, 10:43 AM
jamie jamie is offline
 
Join Date: Oct 2001
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks works great..not sure what firefly is on about (a better way to do it or something, but it went right over my head..)
Reply With Quote
  #9  
Old 08-31-2002, 09:53 PM
CRego3D CRego3D is offline
 
Join Date: May 2002
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this worked GREAT .. is there a way to do it to the USERS as well ?
Reply With Quote
  #10  
Old 08-31-2002, 09:57 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Change in index.php:

PHP Code:
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user'); 
To:

PHP Code:
$numbersmembers=$DB_site->query_first('SELECT userid AS users,MAX(userid) AS max FROM user'); 
That should do the job
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 04:52 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06524 seconds
  • Memory Usage 2,260KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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_postinfo_query
  • fetch_postinfo
  • 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