Re-importing a few custom user fields?


Well-known member
Full disclosure: This was 100% my fault. I ended up with a couple of duplicate custom user fields after the import was complete (also my fault), and went back to delete the dupes in the middle of the night, while I was sleep-deprived, etc. Deleted the wrong fields.

BUT... that data is still in the old DB. And I've got the xf import log saved in a table. I just need a query to fetch the old fields, match them up with the new userids, and plug them in to the right lines in the new db.

Has anybody written such a query, or have recommendations on where to start figuring it out?

Jake Bunce

XenForo moderator
Staff member
It's possible but it requires some doing.

If you copy the relevant table from the source db to the XF db then you can run an update query over multiple tables, utilizing the import_log to map the ids. Unless you selected the option to preserve the source ids in which case you don't need an ID map.

The query would be of the form:

UPDATE table1 AS t1, table2 AS t2
SET t1.field = t2.field
WHERE t1.user_id = t2.user_id;