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

'Uncounting' user posts retroactively from forums with post count disabled

Discussion in 'XenForo Questions and Support' started by Saeed, Sep 11, 2011.

  1. Saeed

    Saeed Well-Known Member

    Hi guys. :)

    As most of you would already know, 1.1 is shipping with the ability to disable post counts at a 'per forum' level. This may be useful for test and game forums. However, this function applies only to posts made after disabling them, and does not work retroactively.

    I have seen many others asking this on the forums here, and am myself interested as well...so my question is, is it possible to 'uncount' posts made prior to disabling post counts in particular forums? Would this be possible by running any queries? Could this be done on a large scale?

    Any help in this regard would be appreciated. :)
  2. Kier

    Kier XenForo Developer Staff Member

    Yes, you could run a query that counts posts by users in a particular forum and subtracts that value from their post count, if you wanted to.
    Saeed likes this.
  3. Saeed

    Saeed Well-Known Member

    Thank you, Kier. :)

    I believe that would mean that the subtraction would have to be done individually for every user. Could the query be run only once and count and output the post count of all users perhaps in the form of a table, from where the subtraction may be done manually one by one for the users?

    Maybe someone could help with the exact query to run. I'm sorry, but they didn't really teach that in medical school. :oops:
  4. Brogan

    Brogan XenForo Moderator Staff Member

    It's going to be a tricky query as the xf_post table doesn't store node_id information, but it does store thread_id data.
    Similarly, the xf_thread table stores node_id but no post_id.

    So it will have to be a query between the xf_user, xf_post and xf_thread tables.

    Where's Jake when you need him :D
    Saeed likes this.
  5. Saeed

    Saeed Well-Known Member

    I see. Well, let's hope Jake will come up with something brilliant. :)
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  7. Saeed

    Saeed Well-Known Member

    And he did! Thanks a ton, Jake! :)

Share This Page