PDA

View Full Version : Where is code to get forum "counters"?


Kaitlyn2004
03-14-2012, 01:53 PM
At the bottom of forum home there is something like this:

Threads: 248,929, Posts: 2,062,013, Members: 455,827, Active Members: 11,109

Every vB has this - but where are those #s actually calculated? Are they just a COUNT(postid) or do they take into account deleted posts, posts in private forums, etc?

setishock
03-14-2012, 02:22 PM
More than likely it's one of the "update" cron jobs. Based on how you have the forums and members set up, it would run the job retrieving the data from the database.

kh99
03-14-2012, 02:34 PM
The counts are kept in the forum table, and calculated for each forum in function build_forum_counters() (in includes/functions_databuild.php). (I'm not sure if that's called whenever a thread or post is added/deleted or a cron job like mentioned above). In forum.php it adds up the totals for all forums. It definitely takes in to account deleted posts and threads, but I don't know about private forums. You should be able to figure that out pretty easily (assuming you have private forums) by comparing what you see when you're logged in vs. logged out.