Is it possible to delete likes?

Jaxel

Well-known member
Would it be okay if I ran this SQL?
Code:
DELETE FROM xf_liked_content WHERE content_user_id = 792

Would this be all that's needed to delete likes from the system? Would this be safe? Would this automatically lower the likes count of a user? Would it happen after a cron job runs? Would it happen AT ALL? Are likes even counted like that at all? Or are they simply added and subtracted from a user's profile as they happen?
 
Check Model/Like.php, method likeContent() line ~140

Code:
                    UPDATE xf_user
                    SET like_count = like_count + 1
                    WHERE user_id = ?

So, to answer your question, that would delete the like, but it would not decrement the amount of likes from the user. Nor it would decrement on a cron job.

There is another count in the like column of the content type. For example, the xf_post table has a likes column, same with xf_profile_post
 
You can manually adjust the like count of a user in the ACP, via the Profile Info tab.
 
Top Bottom