Duplicate User's message count was off

SchmitzIT

Well-known member
Somehow despite running the cron jobs and rebuilding caches, I ended up with a user who consistently showed 3 messages in the system, even though a search for the user's content only showed 2 results:

CounterOff.webp

Prior to rebuilding, there was a Forum result showing up as well, which confused me, but that got handled by the rebuild. However, it somehow was impossible to get the issue addressed.

My final resolution was to go into the user's info in the Admin CP, and use the Messages counter on the Profile Info tab to correct it.

I'm not sure I'll be able to reproduce this particular issue, but I'm hoping that reporting the issue here might lead to the creation of a new cron job to rebuild the messages count in case it does pop up again.

Thanks!

/Peter
 
We don't rebuild the counts. That's intentional. The counts can be independent of posts if desired. So there won't be a built in system for that, at least not in the short term.

This could happen if you change whether a forum counts posts.

Unfortunately otherwise, without reproduction steps or some sort of guidance, there's not much we can do with this report.
 
Also, is it possible the search index is wrong? Or did you rebuild that?

And this query:

Code:
SELECT *
FROM xf_post
WHERE user_id = 9999

Will verify how many posts are in the database. Could be that there's an orphaned post somewhere from a deleted node or some such.

(Replace 9999 with the user's ID)
 
Hi Mike,

To the best of my recollection, no settings were changed to alter post counts for forums. Could it be the result of an import?
 
So, is there a solution here for this issue? Obviously it doesn't look professional if the post counts and other stats on a site are not accurate? If a post is deleted by the poster then obviously the post counter etc should reflect this? This has not happened accurately on my site and so the concern is what kind of impression this will give to early visitors when one is working hard to build a global community...
 
So, is there a solution here for this issue?

Did you not read the entire thread?

We don't rebuild the counts. That's intentional. The counts can be independent of posts if desired. So there won't be a built in system for that, at least not in the short term.

This could happen if you change whether a forum counts posts.

Unfortunately otherwise, without reproduction steps or some sort of guidance, there's not much we can do with this report.
 
Did you not read the entire thread?
I read it but I didn't understand it ... I need a simple answer to a simple question - why is my posts counter not accurate and what needs to be done to fix it? What Mike has said seems to me that you got to live with it? But then again, I don't know what he means?
 
He means the two are not dependent upon each other and the count in the member's popup can reflect a number that isn't a true count. This is by design (for now).

In other words, the number may be correct at one point, but due to changes in the forum design on which posts actually count towards the totals, it may not reflect the real number. Either live with it, or change it in the ACP to reflect the actual totals.
 
Also, is it possible the search index is wrong? Or did you rebuild that?

And this query:

Code:
SELECT *
FROM xf_post
WHERE user_id = 9999

Will verify how many posts are in the database. Could be that there's an orphaned post somewhere from a deleted node or some such.

(Replace 9999 with the user's ID)

I'll just quote myself until someone actually does something with it :p

The following is true:

1) The search index is accurate
2) There are only two visible posts for the user
3) The user has (or had until it was adjusted) a post count of 3

One possible explanation is if a post was made and the thread it was contained in or a forum containing threads was manually removed from the database. This would potentially cause the phantom result that Peter reported above until the caches were rebuilt. The message count isn't retroactively adjusted. So my thinking is there could actually be a third, orphaned post somewhere in the database.

The query would tell us that.
 
Code:
SELECT *
FROM xf_post
WHERE user_id = 9999

Will verify how many posts are in the database. Could be that there's an orphaned post somewhere from a deleted node or some such.


Chris was spot on with this. I ran his query and found a post made in a thread that was created in a node that no longer exists.

Mike, if a user-message-count cron is not in the works, would it be possible to have a cron job prune anything left from a node deletion?
 
It's because a forum containing those posts has been deleted.

The count isn't adjusted when this happens and the posts are not deleted.
 
It's also "cheating/showing the wrong message count", if the posts are in a forum with limited view permissions (e.g. staff forum) .

There's nothing you can do (except to modify it yourself..:P)
If you're using default xf without and custom content types adding their post/comment count to the global user message count, you could run a query and check the permisisons for each post, BUT that would be probably horrible for the performance^^
 
If you're using default xf without and custom content types adding their post/comment count to the global user message count, you could run a query and check the permisisons for each post, BUT that would be probably horrible for the performance^^
Minor understatement there. :)
 
Top Bottom