XF 1.4 manually import post thanks

Jake Bunce

Well-known member
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:

Rich (BB 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
 
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?
 
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.
 
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:
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...
 
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:

Rich (BB 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
Jake,

Do you think this same code will work for XF 2.1.x by just replacing the xf_liked_content table (which would be from XF 1.x) with xf_reaction_content (and assuming the source IDs were preserved during the vb-->xf import process)?

Assuming this query is done via CLI with mysql.

Cheers,
Gerry
 
Jake,

Do you think this same code will work for XF 2.1.x by just replacing the xf_liked_content table (which would be from XF 1.x) with xf_reaction_content (and assuming the source IDs were preserved during the vb-->xf import process)?

Assuming this query is done via CLI with mysql.

Cheers,
Gerry

I would suggest inserting the thanks into the reputation table instead and importing that way.
 
I never used the reputation system in vBulletin, so that table in the vB database is empty.

The post_thanks mod in my vB install had its own table, which is fully populated.
 
Anything for xenforo 2.1 with the new "reactions" system?

Likes are already imported from vBulletin using the Xenforo 2.1 Importer :)
 
Last edited by a moderator:
Back
Top Bottom