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

XF 1.1 Problem: How to remove likes from a user?

Discussion in 'XenForo Questions and Support' started by MrC, Mar 4, 2012.

  1. MrC

    MrC Active Member

    I am using a trophy system based on likes. And some users kept creating new accounts and liked every post on my forums. I am not sure if they were aiming to "destroy" the trophy system or doing it for "fun"!

    So I used the spam button. But it did not remove likes from the users.
    Is there any query I can use to solve this?

  2. Brogan

    Brogan XenForo Moderator Staff Member

    You can manually adjust the Like count for individual users in the ACP.

    You can't easily remove the Likes from the content though.

    Personally speaking I would warn the users and if that doesn't stop them, take further action.
  3. MrC

    MrC Active Member

    I need a way to mass remove Likes from content. Otherwise I will have to manually adjust like counts for all members who posted on the forums and liked by the spammers. The "spammers" would create new accounts and like all posts again (until I stop them temporarily by Ip ban).

    PS: the users did not aim to increase their own account's like counts. They aimed to increase all members's like counts and hence making the like system useless.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Run this query to delete the likes given by the specified user_id:

    FROM xf_liked_content
    WHERE like_user_id = 2;
    Then run this query to recalculate the like_count for all users (big query, might take some time):

    UPDATE xf_user AS u
    SET like_count = (
    	FROM xf_liked_content AS lc
    	WHERE lc.content_user_id = u.user_id
    	GROUP BY lc.content_user_id
    This will correct the user like counts, but it won't correct the like counts in the posts themselves.
    otto, Lone Wolf and MrC like this.
  5. MrC

    MrC Active Member

    Thanks a lot Jake, I will try it in off peak times. I think the troublesome members will stop doing that when they know that "I" know how to deal with the problem.

Share This Page