Migrating users from XenForo to NodeBB
-
Hi all,
I was wondering if there's a plugin, or how easy it would be to write my own, to convert just the user accounts from XenForo to NodeBB. I'm talking around 3,000+ users. No posts, literally just their usernames, emails and passwords... I'm assuming the two platforms don't use the same password salting/hashing process, so would that be an issue?
Thanks!
-
Thinking about it I could simply import the usernames and email addresses, then have the importer create a new random password that conforms to the NodeBB way of storing/hashing passwords, then email these new passwords automatically to users.
That would work and solve a few problems.
I will try to figure out the best way to do this.
-
@thomas0 Sounds like the way to do it.
From what people have been saying here, just make sure you use the plugin-write-api. Makes sure everything regarding user creation is taken care of.
It might be nice to also send a password reset email rather than plaintext password (makes sure they'll change it too, I guess!).
-
@chrisb Great idea for the password reset rather than plain text... more secure!
I will take a look at that api plugin. I'm not a developer as such, rather it's a hobby so I can code but not professionally. My thoughts are...
- Export username / email data
- Create script that adds each username / email pair to NodeBB database, with a random password that works with NodeBB
- Create a script that emails each user the password reset
I will see how I get on!
-
@thomas0 It's worth digging into the code a little bit, more understanding will help when (or if.. ) things go wrong. Just as an example, here's what a typical user object looks like in NodeBB:
{ "_id" : ObjectId("5aa26e9218d8783123dcb189"), "_key" : "user:1", "username" : "MyUsername", "userslug" : "myusername", "email" : "[email protected]", "joindate" : 1520594578043, "lastonline" : 1520602862371, "picture" : "", "fullname" : "", "location" : "", "birthday" : "", "website" : "", "signature" : "", "uploadedpicture" : "", "profileviews" : 0, "reputation" : 0, "postcount" : 1, "topiccount" : 1, "lastposttime" : 1520594579361, "banned" : 0, "status" : "online", "uid" : 1, "password" : "$2a$12$SnwLqMV2.g8ADjLEV.2tK.hGGD1o85rm4Tb/aj2twrTuU5BewqMCW", "passwordExpiry" : 0, "groupTitle" : "administrators", "rss_token" : "2e3df2a7-f579-431f-b5ad-fgh52b995b1c" }
(Just making the point you'd have to create all that extra data too, that the write-api plugin would do for you).
Actually, it's more than I thought. See this list from @PitaJ
Adding User Programatically
This is a probably incomplete list of what needs to be done on user creation: get nextUid create userslug make sure userslug is unique increment uid save al...
NodeBB Community (community.nodebb.org)
-
@chrisb said in Migrating users from XenForo to NodeBB:
@thomas0 It's worth digging into the code a little bit, more understanding will help when (or if.. ) things go wrong. Just as an example, here's what a typical user object looks like in NodeBB:
{ "_id" : ObjectId("5aa26e9218d8783123dcb189"), "_key" : "user:1", "username" : "MyUsername", "userslug" : "myusername", "email" : "[email protected]", "joindate" : 1520594578043, "lastonline" : 1520602862371, "picture" : "", "fullname" : "", "location" : "", "birthday" : "", "website" : "", "signature" : "", "uploadedpicture" : "", "profileviews" : 0, "reputation" : 0, "postcount" : 1, "topiccount" : 1, "lastposttime" : 1520594579361, "banned" : 0, "status" : "online", "uid" : 1, "password" : "$2a$12$SnwLqMV2.g8ADjLEV.2tK.hGGD1o85rm4Tb/aj2twrTuU5BewqMCW", "passwordExpiry" : 0, "groupTitle" : "administrators", "rss_token" : "2e3df2a7-f579-431f-b5ad-fgh52b995b1c" }
(Just making the point you'd have to create all that extra data too, that the write-api plugin would do for you).
Actually, it's more than I thought. See this list from @PitaJ
Adding User Programatically
This is a probably incomplete list of what needs to be done on user creation: get nextUid create userslug make sure userslug is unique increment uid save al...
NodeBB Community (community.nodebb.org)
I see. Just a thought but perhaps creating a new fresh user with no data as such (ie avatar, standard usergroup etc) and then basing the inserts off of that... of course username, email, password, last online, userid, slug, etc would be changed.
-
You could, but you'll miss out from the things in the list I linked.
It looks fairly straightforward to use:
nodebb-plugin-write-api/routes/v2/readme.md at master 路 NodeBB/nodebb-plugin-write-api
A RESTful JSON-speaking API allowing you to write things to NodeBB - nodebb-plugin-write-api/routes/v2/readme.md at master 路 NodeBB/nodebb-plugin-write-api
GitHub (github.com)
(POST a username and (optionally) a password and email to the endpoint; job done).
-
There鈥檚 a caveat that you have to start on an older version of Nodebb, but:
https://www.npmjs.com/package/nodebb-plugin-import
https://www.npmjs.com/package/nodebb-plugin-import-xenforoEdit: looks like it was updated to support a more recent version of NBB