XF 1.3 Replace user_id in threads and posts from a import

slewis1972

Member
Ok, as per previous post, importing from joomla into xenforo for users via jfusion.

I now plan to do a import into ipboard from Kunena (as thats the forum software on joomla), and them xenforo import from ipboard. Tests I have done, it was always the users bit that got messed up hence the jfusion import

Anyway, the user ID's in the posts and threads are way when importing from ipboard BUT the usernames are good.

I have looked at this post:

http://xenforo.com/community/threads/after-import-some-posts-by-guest.48691/#post-522195

But my mysql skills are rudimentary. I basically want to replace the user_id in posts and threads with the same user_id that matches the usernames in say xf_users. Any ideas if possible?

I can then rebuilt the thread counts and clear all caches and fingers crossed it should all match up again.

Any ideas?
 
This query will update post user_id based on matching usernames. This may work for your situation, but I can't say for certain.

Code:
UPDATE xf_post AS p
SET p.user_id = (
	SELECT u.user_id
	FROM xf_user AS u
	WHERE u.username = p.username
) WHERE p.user_id = 0;
 
Top Bottom