XF 1.5 Change what goes into the total like_count

WebbyG

New member
Hello!

I am trying to find a way to change what's counted in like_count. We're trying to make like_count to only count likes from threads and thread replies, and not include profile post likes. Is there an easy way or tutorial about this? Maybe a plugin?

Site: Mineplex.com
Version: 1.5.X

Thank you!
 
XenForo_Model_Like::likeContent
XenForo_Model_Like::unlikeContent

You need to overwrite this functions.
First param is $contentType (post, profile_post, profile_post_comment)

So write something like:
PHP:
if (!in_array($contentType, ['profile_post', 'profile_post_comment']))
                {
                    $db->query('
                        UPDATE xf_user
                        SET like_count = like_count + 1
                        WHERE user_id = ?
                    ', $contentUserId);
                }


If contenttype is no profile_post, profile_post_comment, then increment like_count. Good luck
 
Top Bottom