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


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?



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.


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.

Jake Bunce

XenForo moderator
Staff member
Run this query to delete the likes given by the specified user_id:

Rich (BB code):
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.


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.