The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
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 |
#3
|
|||
|
|||
What if you already pruned and did the damage? How can you restore the count?
Ideas? Thanks! |
#4
|
||||
|
||||
@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 |
#5
|
|||
|
|||
any way so it can be like this
Threads: XXX | Posts: xxx | Total Posts: XXX |
#6
|
||||
|
||||
Quote:
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 |
#7
|
||||
|
||||
Logician: Just use [minicode]MAX(postid) AS maxpostid[/minicode], no need for the [minicode]ORDER BY[/minicode] and [minicode]LIMIT[/minicode].
|
#8
|
|||
|
|||
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..)
|
#9
|
|||
|
|||
this worked GREAT .. is there a way to do it to the USERS as well ?
|
#10
|
||||
|
||||
Change in index.php:
PHP Code:
PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|