Importing Existing Users with Passwords

I have an existing legacy PHP site of 15000 users with base64 hashed passwords , I would like to import all these users into the new wordpress site with their passwords , What would be the best approach to realize this?

Praveen

3 Answers
3

You can use wp_insert_user. Since your old database has passwords in base64, you can easily get the original password string using base64_decode.

$new_user_data = array(
        'user_pass' => 'password',//pass your decoded password string
        'user_login' => 'username',//pass your username
        'user_email' => 'email',
        'first_name' => 'firstname',
        'last_name' => 'lastname',
        'role' => 'author'//if you want to specify a different role other than default one
);
wp_insert_user( $new_user_data );

You need to format your old data in csv or xml or text file and read and pass them accordingly. And don’t try to import all 15000 users at once. Do this in several parts. Also sleep() function will be quiet good to give the server some rest.

Leave a Comment