profiles - Importing users from one database to another and saving passwords

I have been trying to formulate a way to take a database SQL file of users from one database and add it to another WordP

I have been trying to formulate a way to take a database SQL file of users from one database and add it to another WordPress database while saving the old WordPress site passwords on the new WordPress install. I know that the salts need to be the same for it to work, and I know that the wp_usermeta and wp_user are the tables i need to import.

I just need to know if it do this will people still need to change their passwords?

I have been trying to formulate a way to take a database SQL file of users from one database and add it to another WordPress database while saving the old WordPress site passwords on the new WordPress install. I know that the salts need to be the same for it to work, and I know that the wp_usermeta and wp_user are the tables i need to import.

I just need to know if it do this will people still need to change their passwords?

Share Improve this question edited Jan 3, 2018 at 9:56 bueltge 17.1k7 gold badges62 silver badges97 bronze badges asked Dec 28, 2017 at 0:00 M.MccreaM.Mccrea 412 bronze badges 4
  • I can do a migration and it keeps all the users and pass, there must be a way. Does the site you are migrating too need to stay in-tact and you are just adding the users? – Patrick Commented Dec 28, 2017 at 7:41
  • yes, it should remain the same and i just need to add the users. – M.Mccrea Commented Dec 28, 2017 at 14:55
  • Does anyone else have a suggestion? – M.Mccrea Commented Jan 2, 2018 at 18:08
  • Migrating WordPress users with their password is easily possible with this free WordPress user import export plugin by WebToffee. – mujuonly Commented Oct 17, 2019 at 6:15
Add a comment  | 

1 Answer 1

Reset to default 0

At first, I think you should sync your database tables via linux rsync command. It is a solid way, more as an script inside your wp install and his dependencies.

However you will update the password in the second table after an change of a password. I think you should use the WP hook after the change and fire on this hook an copy of the password. The hook is

/**
  * Fires after the user's password is reset.
  *
  * @since 4.4.0
  *
  * @param object $user     The user.
  * @param string $new_pass New user password.
  */
  do_action( 'after_password_reset', $user, $new_pass );

However you can also use the hook after a change of the profile, that include the change of the password - Hook profile_update.

/**
 * Fires immediately after an existing user is updated.
 *
 * @since 2.0.0
 *
 * @param int     $user_id       User ID.
 * @param WP_User $old_user_data Object containing user's data prior to update.
 */
do_action( 'profile_update', $user_id, $old_user_data );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745073884a4609719.html

相关推荐

  • profiles - Importing users from one database to another and saving passwords

    I have been trying to formulate a way to take a database SQL file of users from one database and add it to another WordP

    14小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信