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

Resetting a User's post count

Discussion in 'XenForo Questions and Support' started by Valkyr, Jul 28, 2011.

  1. Valkyr

    Valkyr Member

    An admin friend of mine messed with the post count of another user, I was wondering how I could reset this to the actual amount instead of "69" ;). He did this on the "profile info" page of the user.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There isn't a rebuild for this. But you can manually edit the count in their profile:

    Admin CP -> Users -> Search for Users -> [find their account]

    If you need to know the user's true post count then you can run this query on the database:

    Code:
    SELECT user_id, COUNT(*) AS posts
    FROM xf_post
    WHERE user_id = 1
    GROUP BY user_id
    
    Change the user_id appropriately.
     
  3. ragtek

    ragtek Guest

    that's the COMPLETE postcount ignoring the different post states (soft deleted, moderated)

    SELECT user_id, COUNT(*) AS posts FROM xf_post WHERE user_id = 1
    AND
    message_state = 'visible'
    GROUP BY user_id
     
  4. Valkyr

    Valkyr Member

    That worked a charm, don't suppose you have one for likes and trophy points? :)
     
  5. Valkyr

    Valkyr Member

    Bump D:? <3
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This query will return the number of likes for the specified content_user_id:

    Code:
    SELECT content_user_id, COUNT(*) AS likes
    FROM xf_liked_content
    WHERE content_user_id = 1
    GROUP BY content_user_id;
    
    This query will return the number of trophy points for the specified user_id:

    Code:
    SELECT SUM(t.trophy_points) AS tpoints
    FROM xf_user_trophy AS ut
    LEFT JOIN xf_trophy AS t ON (t.trophy_id = ut.trophy_id)
    WHERE ut.user_id = 1;
    
     
  7. Valkyr

    Valkyr Member

    Realized I could just count the trophies the user has received. Haha.

    The likes worked perfectly though, thankyou!
     

Share This Page