• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 manually import post thanks

Jake Bunce

XenForo moderator
Staff member
#1
I am posting this here for reference.

This assumes you enabled the option during the import to preserve the source ids.

If you use the "post thanks" addon in vB and you want to manually import those "thanks" as "likes" then run this query:

Code:
INSERT INTO XFdbname.`xf_liked_content` (content_type, content_id, like_user_id, like_date, content_user_id)
	SELECT 'post', vl.postid, vl.userid, vl.date, post.userid
        FROM vBdbname.`post_thanks` AS vl
        LEFT JOIN vBdbname.`post` AS post ON (post.postid = vl.postid)
ON DUPLICATE KEY UPDATE
        content_id = VALUES(content_id);
Then run this script:

https://xenforo.com/community/threa...t-profile-post-like-caches.42384/#post-457352
 
#2
got a message by running the query in mysql (xf db):
Code:
#1142 - SELECT command denied to user '..'@'..' for table 'post_thanks'
maybe I dont have the permission to run this query..

what can I do?
 

Jake Bunce

XenForo moderator
Staff member
#4
got a message by running the query in mysql (xf db):
Code:
#1142 - SELECT command denied to user '..'@'..' for table 'post_thanks'
maybe I dont have the permission to run this query..

what can I do?
The query does span two databases. So your MySQL user needs access to both the vB and XF databases. Otherwise you can copy the post_thanks table to your XF database to avoid having to query two different databases at once.
 
#5
i copied the table post_thanks to my XF database,

got a new message by running the query:

Code:
#1146 - Table 'd001cfc10.post' doesn't exist
i run this query without db-names:

Code:
INSERT INTO `xf_liked_content` (content_type, content_id, like_user_id, like_date, content_user_id)
   SELECT 'post', vl.postid, vl.userid, vl.date, post.userid
  FROM `post_thanks` AS vl
  LEFT JOIN `post` AS post ON (post.postid = vl.postid)
ON DUPLICATE KEY UPDATE
  content_id = VALUES(content_id);
 
Last edited:

Jake Bunce

XenForo moderator
Staff member
#6
i copied the table post_thanks to my XF database,

got a new message by running the query:

Code:
#1146 - Table 'd001cfc10.post' doesn't exist
i run this query without db-names:

Code:
INSERT INTO `xf_liked_content` (content_type, content_id, like_user_id, like_date, content_user_id)
   SELECT 'post', vl.postid, vl.userid, vl.date, post.userid
  FROM `post_thanks` AS vl
  LEFT JOIN `post` AS post ON (post.postid = vl.postid)
ON DUPLICATE KEY UPDATE
  content_id = VALUES(content_id);
edit:
I think I cant take "Left Join" now ... Can I use INTO instead of Left Join?
Oh you need to copy the 'post' table too...