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

XF 1.3 Replace user_id in threads and posts from a import

Discussion in 'Installation, Upgrade, and Import Support' started by slewis1972, May 15, 2014.

  1. slewis1972

    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:


    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?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

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

    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;
  3. Vladislav Rastrusny

    Vladislav Rastrusny Active Member

    Is the problem still actual?

Share This Page