XF 2.1 Total messages in xenforo different from database query?

Mave

Active member
aucbrQx.png


As you can see total messages is 137k

However through the following query: SELECT COUNT(*) FROM xf_post WHERE xf_post.user_id = 1

I'm getting 135667 as the result, where does the difference come from? And how do I edit my query to reflect the actual # of posts?
 
The discrepancy is either soft-deleted posts (they aren't removed from the database, so will be included in your query), or posts in forums set to not count towards users' post count.

You can exclude soft-deleted (and moderated) posts from your query with this condition: AND xf_post.message_state = 'visible'.
 
The discrepancy is either soft-deleted posts (they aren't removed from the database, so will be included in your query), or posts in forums set to not count towards users' post count.

You can exclude soft-deleted (and moderated) posts from your query with this condition: AND xf_post.message_state = 'visible'.
Thanks!
 
The discrepancy is either soft-deleted posts (they aren't removed from the database, so will be included in your query), or posts in forums set to not count towards users' post count.

You can exclude soft-deleted (and moderated) posts from your query with this condition: AND xf_post.message_state = 'visible'.
Actually @Liam W I'm getting less results now (only a few), which is expected. But Xenforo lists MORE results than what I get from a database query... I'm guessing my stats are messed up?
 
Back
Top Bottom