Setting up a user programatically


Well-known member
Would anyone know which tables are involved when a user is created? I am trying to import users through a third-party system (Microsoft SQL Server Integration Services), and while my import populates the xf_user table, when I try and check the user list in Admin CP, and can see the users there, clicking them gives an error message.

I populated a few of the other tables as well (xf_user_profile, xf_user_custom_field and xf_useR_authenticate (I essentially created a user IN the system first, and then grabbed the generated hashed password from that, and recreated them for all users in the import), but somehow it seems like I still miss something.

I'm trying to import from a non-mySQL database, and believe that if this can be pulled off, there would be a whole new range of non-mySQL forums that suddenly could get converted to XenForo, but the fact there's errors slightly concerns me.

I have two users working now for some odd reason (I think it might be leftovers from manually created XenForo users, so obviously something is still stored somewhere. I just cannot figure out which table, and i checked the xf_user* tables).

Thanks in advance :)



You SHOULD use the xenforo user datawriter for this!

There are too many dependencies for an user.
You could also check the user datawriter, to see the related tables;)


Well-known member
Well, I would love to use the XenForo DataWriter if I could use that to connect to other database systems (Microsoft SQL in this case). I wanted to use SSIS since it's an easy way to move data across different database platforms (and I know how to use it already, unlike the XF datawriter stuff).

I will try the privacy table, that's about the only one I might not have looked at yet, but I don't get why there is additional stuff going on under the hood everywhere. I had similar issues when trying to programatically add a custom user field; to avoid having to manually do all the work, I could whip up a quick query, but also there, just adding a field to the database table does not work.

I wish it would be made easier to get stuff done, rather than having to rely on the DataWriters in order to perform something as simple as adding a record to one or more tables.