XF 2.2 Drupal users to 2.2

stromb0li

Well-known member
I am working on a migration of about 5k users from a Drupal deployment to XenForo. I don't need to carry over anything other than the users.

My current thought is to write a quick script that populates the user info into the XML format of the data-portability import/export users feature in the Admin Control Panel.

Would this be a decent approach, or should I consider another way to import the user (my understanding is direct insert into xf_user table is not best practice)? If so, does the import feature of the admin control panel batch the requests of a single XML file or should I split the import into chunks of X users?

Thank you!
 
I am working on a migration of about 5k users from a Drupal deployment to XenForo. I don't need to carry over anything other than the users.

My current thought is to write a quick script that populates the user info into the XML format of the data-portability import/export users feature in the Admin Control Panel.

Would this be a decent approach, or should I consider another way to import the user (my understanding is direct insert into xf_user table is not best practice)? If so, does the import feature of the admin control panel batch the requests of a single XML file or should I split the import into chunks of X users?

Thank you!
It's better if you use XenForo API.
 
Calling POST API for users endpoint 5k times seems like it would be more processing than bulk import via Admin CP, no? I was looking at the
AbstractForumImporter from the Importer add-on, but that seems like a lot of effort to only use once :P
 
Why don't you use a test install of XF to see how well the different approaches work? Import performance isn't much of an issue for a one time task, but what you don't want is for the system to choke on the sheer number of users in one go and bug out.
 
One other catch is since Drupal 9 does hash the passwords, I'd need to trigger a password reset during import. I don't see the ability to trigger password reset emails via API.
 
I guess you are a developer? If yes, then just write own Authentication class and set correctly scheme_class in xf_user_auth table when importing.

For examples, see src/XF/Authentication/ directory.
 
I guess you are a developer? If yes, then just write own Authentication class and set correctly scheme_class in xf_user_auth table when importing.

For examples, see src/XF/Authentication/ directory.
I saw this in the importer examples. As users change their password, do they go back to xenforo auth or do those users continue to use the Drupal auth class to validate hashes?
 
Thought I'd provide some thoughts since I found out the hard way that User Import/Export can only be used for a single user.

Ultimately, I did mass creation of the users via API as @JustinHawk mentioned. This worked well, but I would recommend writing the script to make async calls to speed up creation of the users. Serial calls via curl can still take time at larger scale.

Additionally, character escapes have to be considered and manually written. It's too bad XenForo 2.2.X API doesn't support JSON encoded payloads, where there are many native ways to encode the content being sent. I found myself having to write a lot of custom handling for extended ascii characters, single quotes, etc.

The other downside to creation of users via API though is how to handle post-creation of the users. @JustinHawk when you created users in bulk via API, how did you end up notifying end users their account has been created? Did you store the list of passwords and send out, with a force of password reset on login, or did you mass-mail everyone created as a separate step with a generic link the password reset form?
 
@JustinHawk when you created users in bulk via API, how did you end up notifying end users their account has been created? Did you store the list of passwords and send out, with a force of password reset on login, or did you mass-mail everyone created as a separate step with a generic link the password reset form?
1704092025625.webp

XenForo by default has this feature to send reset password confirmation mail for a single single user. To run it for every user, simply create a Rebuild job that will do it. Though i'm not sure if the batch update users and lock their profiles will do the same job or not. But you can do this by creating a rebuild job functionality easily.
 
Last edited:
Back
Top Bottom