1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Duplicate User's message count was off

Discussion in 'Resolved Bug Reports' started by SchmitzIT, Jun 12, 2013.

  1. SchmitzIT

    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:


    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.


  2. Mike

    Mike XenForo Developer Staff Member

    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.
  3. Chris D

    Chris D XenForo Developer Staff Member

    Also, is it possible the search index is wrong? Or did you rebuild that?

    And this query:

    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)
  4. SchmitzIT

    SchmitzIT Well-Known Member

    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?
  5. SchmitzIT

    SchmitzIT Well-Known Member

    I rebuilt everything and even reran all cron jobs to try and get it to sort itself out.
  6. Chris D

    Chris D XenForo Developer Staff Member

    The rest of my post is potentially relevant.
  7. OverHere

    OverHere Active Member

    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...
  8. Biker

    Biker Well-Known Member

    Did you not read the entire thread?

    OverHere likes this.
  9. OverHere

    OverHere Active Member

    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?
  10. Biker

    Biker Well-Known Member

    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.
  11. Jeremy

    Jeremy Well-Known Member

  12. Biker

    Biker Well-Known Member

  13. OverHere

    OverHere Active Member

    Yes it wasn't fixed but what @Biker says about changing something in the ACP is what I'll ask Peter to do...
  14. OverHere

    OverHere Active Member

    No no, he hasn't fixed it - he's working on my website and the issue remains...
  15. Chris D

    Chris D XenForo Developer Staff Member

    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 Monkey likes this.
  16. SchmitzIT

    SchmitzIT Well-Known Member

    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?
    OverHere and Chris D like this.
  17. xf_phantom

    xf_phantom Well-Known Member

  18. Chris D

    Chris D XenForo Developer Staff Member

    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.
  19. xf_phantom

    xf_phantom Well-Known Member

    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^^
  20. Mike

    Mike XenForo Developer Staff Member

    Minor understatement there. :)

Share This Page