Reputation: 57
So I am currently building a new Wordpress site that has a functionality where users can login and create a business listing for themselves. All of these users are currently using another site of the clients to perform other business aspects.
We are looking at bringing all the sites together in time.
Right now though, I have a user table on the existing site that has login details (username, display name and password among others). I want to grab these details including the MD5 hashed password field and import it into the Wordpress users table?
Is this even possible?
Thanks, A
Upvotes: 1
Views: 1601
Reputation: 57
I have managed to find a way to do this. It may be a little backwards, and please correct me if I have this entirely wrong.
I grabbed a SQL dump from the old database using phpMyAdmin of the fields that I needed. I edited the SQL file and adjusted the field names to correlate with the Worpress wp_users
table. Then in the new database I used an INSERT INTO
command to create the new users.
In Wordpress I then had to assign all the new users a role.
It took the MD5 hashed password and stored it initially in the DB but on the first login it changed the encryption to phpass.
Hope this helps anyone else looking.
A
Upvotes: 1
Reputation: 7694
It seems most of the data is transferable, you'll need a script or something to make sure all the data from your other website is inserted the right way in your wp_users
and wp_usermeta
table.
All data you want to save extra for users, can be inserted in the wp_usermeta
table as key-value pair.
To make sure users can login into the new WordPress site :
This is possible if you set your security in WordPress using MD5
hash only without using a salt.
You can do this by overwriting wordpress's wp_hash_password()
method.
But you are better of letting existing users change their PW, because MD5
is really insecure.
Upvotes: 1