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

XF 1.4 Number of user posts

Discussion in 'XenForo Questions and Support' started by AndreaMarucci, Jun 11, 2015.

  1. AndreaMarucci

    AndreaMarucci Well-Known Member

    I'd like to know if there's a way to exclude certain forums from the total number of messages of each member.

    I've one forum devoted to chitchat and it's widely used but I don't want that all the messages posted here count towards the number of messages of each user.

    I've also seen that from @Jake Bunce
    Code:
    UPDATE xf_user AS user
    SET message_count = (
        SELECT COUNT(*)
        FROM xf_post AS post
        LEFT JOIN xf_thread AS thread ON (thread.thread_id = post.thread_id)
        WHERE post.user_id = user.user_id
        AND thread.node_id NOT IN (1,2,3)
        AND post.message_state = 'visible' AND thread.discussion_state = 'visible'
        GROUP BY post.user_id
    );
    where I can input the ID of the forum I don't want to count...

    Can I use this one or there's a better way to do that?
     
    Last edited: Jun 11, 2015
  2. Martok

    Martok Well-Known Member

    In the ACP, edit a node and in the forum options tab, untick "Count messages posted in this forum toward user total". You may then need to rebuild the caches (can't remember which one).
     
  3. AndreaMarucci

    AndreaMarucci Well-Known Member

    Thanks Martok. Done that. May is this one?

    Rebuild Thread Information -> Rebuild position and post counters
     
  4. AndreaMarucci

    AndreaMarucci Well-Known Member

    I've unflagged the check and rebuilt the cache but the message count is the same as before...
     
  5. Mike

    Mike XenForo Developer Staff Member

    There's no rebuild built-in. You need to do it via that query. Change the numbers here to the forums that don't count:
    Code:
    thread.node_id NOT IN (1,2,3)
     
  6. AndreaMarucci

    AndreaMarucci Well-Known Member

    Fantastic thanks!
     
  7. AndreaMarucci

    AndreaMarucci Well-Known Member

    Done with success, thanks!
     

Share This Page