Like Posts

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

Previous topic - Next topic

SGTC

Quote from: vbgamer45 on June 02, 2022, 02:02:53 PMYeah the upgrade script failed for some reason tables are not setup with the right columns. I would drop the old like data if possible.

I did drop the old like data, and it still didn't work.

Doug Heffernan

Quote from: SGTC on June 02, 2022, 02:51:58 PMI did drop the old like data, and it still didn't work.

Can you double check to make really sure? Because the error message that you posted in your previous post indicates otherwise.

SGTC

Quote from: Doug Heffernan on June 02, 2022, 03:33:42 PM
Quote from: SGTC on June 02, 2022, 02:51:58 PMI did drop the old like data, and it still didn't work.

Can you double check to make really sure? Because the error message that you posted in your previous post indicates otherwise.


I did. It didn't work.

Doug Heffernan

Quote from: SGTC on June 02, 2022, 03:47:28 PMI did. It didn't work.

What is the prefix of your smf forum tables?

SGTC

Quote from: Doug Heffernan on June 02, 2022, 04:02:10 PM
Quote from: SGTC on June 02, 2022, 03:47:28 PMI did. It didn't work.

What is the prefix of your smf forum tables?
Quote from: Doug Heffernan on June 02, 2022, 04:02:10 PM
Quote from: SGTC on June 02, 2022, 03:47:28 PMI did. It didn't work.

What is the prefix of your smf forum tables?

backup_pinchbacksforum_

SGTC

I'm currently waiting for a solution since I don't know much about SQL commands. Anyone still got a solution yet?

vbgamer45

I am out of ideas for now... Unless you mainly edit the mod's package and remove the upgrade check code but i can't guarantee the mod will work.
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

Arantor

If you're editing tables with a prefix of backup_something_, you might not be editing the actual tables that need changing? (Since SMF does backups using backup_ in front of the real prefix)

SGTC

#1228
Quote from: vbgamer45 on June 03, 2022, 03:21:47 PMI am out of ideas for now... Unless you mainly edit the mod's package and remove the upgrade check code but i can't guarantee the mod will work.

It worked! I edited the install.php to get rid of the update/upgrade code and got rid of the releases folder inside the package, and now I can use the mod! Thank you so much!

Julius_2000

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;



Hi everyone! Could anyone please tell me where I would need to place the code (which php file)? Is there anything to add? I'm practically a beginner but have managed so far to edit some php.

Thank you in advance!

Doug Heffernan

Quote from: Julius_2000 on August 29, 2022, 11:33:05 AM
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;



Hi everyone! Could anyone please tell me where I would need to place the code (which php file)? Is there anything to add? I'm practically a beginner but have managed so far to edit some php.

Thank you in advance!

You will have to run the sql queries manually from phpmyadmin, or whatever script you are using to manage the database.

Julius_2000

#1231
Thanks, Doug, for your "delivery" :-D !
Well, unfortunately I'm not the server host, so I'm unable to do it myself. Could you give me a brief explanation on how it's done in the database so I could relay that to the site owner?

Doug Heffernan

Quote from: Julius_2000 on August 30, 2022, 05:56:29 AMThanks, Doug, for your "delivery" :-D !
Well, unfortunately I'm not the server host, so I'm unable to do it myself. Could you give me a brief explanation on how it's done in the database so I could relay that to the site owner?


Give the forum owner the sql queries above and tell them to run them in the SQL box of the forum 's database at the phpmyadmin.

Why does not the forum owner read this topic for themselves btw?

Julius_2000

Quote from: Doug Heffernan on August 30, 2022, 08:05:32 AM
Quote from: Julius_2000 on August 30, 2022, 05:56:29 AMThanks, Doug, for your "delivery" :-D !
Well, unfortunately I'm not the server host, so I'm unable to do it myself. Could you give me a brief explanation on how it's done in the database so I could relay that to the site owner?


Give the forum owner the sql queries above and tell them to run them in the SQL box of the forum 's database at the phpmyadmin.

Why does not the forum owner read this topic for themselves btw?
Thank you for your reply!
Well, it wasn't planned that I'd be working on any of this, but being a moderator on our forum, I asked if I could help with a new theme that was necessary for the new SMF 2.1 update which we haven't upgraded to yet. The site owner seems quite busy at the moment (we're currently only two active admins) and lives in a different timezone. And now that I involved myself with the css and php modding (first time ever) I try to figure out as much as possible by myself to be able to immediately realize my ideas. Hence, I do a lot of research and try to learn a thing or two in the process. So, lots of questions come up when I encounter things that I'd like to adapt or am having problems with.

But of course I can link him this topic. Thanks again, Doug! (big fan of the show as well!)

Doug Heffernan

Quote from: Julius_2000 on August 31, 2022, 10:20:09 AMAnd now that I involved myself with the css and php modding (first time ever) I try to figure out as much as possible by myself to be able to immediately realize my ideas. Hence, I do a lot of research and try to learn a thing or two in the process.

Congratulations on your coding journey. Whenever you will run into something that you will need help with, please do not hesitate to let us know.

Quote from: Julius_2000 on August 31, 2022, 10:20:09 AMThanks again, Doug!

You are very welcome :)

Quote from: Julius_2000 on August 31, 2022, 10:20:09 AM(big fan of the show as well!)

Glad to see another fellow fan of K.O.Q.

Steve

Oh lordy, don't get Doug started on talking about that show!  :P
DO NOT pm me for support!

Doug Heffernan

Quote from: Steve on August 31, 2022, 11:01:52 AMdon't get Doug started on talking about that show!  :P

Indeed, lol :D

jsx

Quote from: vbgamer45 on September 08, 2021, 07:41:30 AM@landyvlad  @shawnb61

Forgot about the sql script! Made it into a php script you can run as well.

@vbgamer45

After upgrading the forum to SMF 2.1.2, should I upload the importlikes.php file to the server and run it? And this way I will transfer the likes from this mod's database table to the SMF 2.1 likes system? And that's all?

I have to use this script too? Is it already included in the importlikes.php file?

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;


vbgamer45

You can run either the php or just run the sql statements
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

jsx

Thanks for the clarification.

Advertisement: