• 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?

MrC

Active member
#1
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?

Cheers
 

Brogan

XenForo moderator
Staff member
#2
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.
 

MrC

Active member
#3
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
#4
Run this query to delete the likes given by the specified user_id:

Code:
DELETE
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):

Code:
UPDATE xf_user AS u
SET like_count = (
	SELECT 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.
 

MrC

Active member
#5
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.