Like Posts

Started by vbgamer45, June 29, 2013, 09:29:03 AM

Previous topic - Next topic

vbgamer45

Anything in the browser error console for javascript?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

GF2022

Quote from: vbgamer45 on January 28, 2022, 07:52:23 AMAnything in the browser error console for javascript?
No. Javascript object has right user inside of it but they are not displayed when ....
Is is a CSS issue. Which is the class of the box that displays the users that liked a post?

landyvlad

I am currently using this mod.

Presumably the likes are held in the database.

When upgrading from 2.0.19 to 2.1.0 (full upgrade package) is it possible to carry over the likes to the new forum? (Given that it's a core feature of the 2.1.x series, not a mod)

If so, how would I go about doing so please?

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it

landyvlad

Quote from: shawnb61 on March 11, 2019, 12:06:57 PMI've been using the following, seems to work (updated from one I shared earlier in this thread).

Note that if you compare counts, they don't line up perfectly, but that ties back to the fact that deleted users/posts linger in the source tables.

--
-- Simple utility to migrate Like Posts mod history
-- to the SMF 2.1 vanilla table.
--
-- Note that in Like Posts, 'topic' likes referenced the first post
-- in the topic.  I.e., all likes were 'msg' likes.   
--
-- Uses IGNORE in case of dupes or reloads. 
-- Found that Like Posts somehow let folks like some things 2x,
-- so dupes may be found in the like_post table.
--

INSERT IGNORE INTO smf_user_likes
    (id_member, content_type, content_id, like_time)
SELECT id_member_gave, 'msg', id_msg, liked_timestamp
    FROM smf_like_post;

--
-- Now for the counts in the messages table.
--

UPDATE smf_messages msg
INNER JOIN
(
   SELECT content_id, COUNT(*) AS like_count
   FROM smf_user_likes
   WHERE content_type = 'msg'
   GROUP BY content_id
) lc ON msg.id_msg = lc.content_id
SET msg.likes = lc.like_count;



Mate where/how do I run that code please?
I'm not very familiar with playing with sql, tables etc.
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it

shawnb61

Quote from: landyvlad on February 09, 2022, 09:41:41 PMMate where/how do I run that code please?
I'm not very familiar with playing with sql, tables etc.

The first thing to do is to edit it & change the prefix accordingly.  I.e., if your tables don't start with smf_, then change those.

Do you use phpMyAdmin?  If so, pull up your database in phpMyAdmin, open up the SQL tab, then copy & paste this in there, & execute it.

(You may get a bunch of 'Duplicate Entry' warnings.  It's safe to ignore those.)
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

landyvlad

Thanks for that. :D
I'll try it when I do my test upgrade.
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it

danielrichter

@vbgamer45 is there an option to make "unlik" impossible? Currently planning to implement your mod to an existing project but I would like to prevent possible spam / not required to have unlike functionality.

Dblog

In 2.1.x is there anyway to display total likes recieved by a user in their profile (along with avatar in each post like it used to appear till 2.0.19)

vbgamer45

Quote from: Dblog on March 07, 2022, 11:31:54 AMIn 2.1.x is there anyway to display total likes recieved by a user in their profile (along with avatar in each post like it used to appear till 2.0.19)
No but wish that was a feature in 2.1
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Kindred

likes are not per user. They are based on POST...    the entire point of likes versus Karma is to *REMOVE* the count attached to the user/person - because it was so abused.
Слова
Украина

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

The main reason it's not a feature is that SMF 2.1 likes aren't just for posts. The system was set up for all kinds of content to get likes. At which point the number of likes isn't particularly relevant.

The fact that it was also designed to reduce gamification by individuals was mostly a side effect. It's also better for performance this way short of keeping counts per user per type of like.
No good deed goes unpunished / All helpful urges should be circumvented

I have something to say: it's better to burn out than to fade away. There can be only one.

vbgamer45

I would like to see a top liked users page though/list
https://www.simplemachines.org/community/index.php?action=stats
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

FrizzleFried

I am confused.  I am trying to follow the conversation but somewhere got lost.  Doesn't SMF keep track of likes per user?   If not,  how is that stats page generated with the top liked user?


Arantor

It's worked out on demand. The only actual record is 'user x liked content type y, item z', e.g. 'Arantor liked msg 12345'

Which means you have to do lookups from likes to content to content owner. This is all, I should add, by design since it's managed by content type, not just posts. Though nothing is using it yet as far as I know.
No good deed goes unpunished / All helpful urges should be circumvented

I have something to say: it's better to burn out than to fade away. There can be only one.

JessyKa

What would be great is to have shown the most liked posts in every thread.

Anyway: noce to have this function. Thanks

Advertisement: