Support » Plugin: WP-Members Membership Plugin » Send new password to a new database after password change/reset

  • Thank you for the excellent plugin!

    I have two scripts working together, I need to keep user information synchronized. I have no issues for the username. For the password, I have tried 2 hooks, ‘password_reset’ and ‘check_passwords’, but it is not accomplishing:

    add_action( 'password_reset', 'change_password_in_other_script', 10, 2 );
    add_action( 'check_passwords', 'change_password_in_other_script', 10, 2 );
    function change_password_in_other_script( $user, $new_pass ) {
    
    	// OTHER DB CREDENTIALS
    	global $addShareDB;
    	// INITIALIZE OTHER DB CONNECTION
    	$mydb = new wpdb( $addShareDB['dbuser'], $addShareDB['dbpass'], $addShareDB['dbname'], $addShareDB['dbhost'] );
    
    	$current_user = wp_get_current_user();
        $current_username = $current_user->user_login;
    
    	$table           = 'enk_account_users';
    	$new_password    = md5( $_POST[ 'pwd' ] );
    	$query = "UPDATE " . $table . " SET password = '" . $new_password . "' WHERE username = '" . $current_username . "'";
    	$mydb->get_results( $query );
    }

    Is there any other hook in wp members or wordpress I can use? Or how can I solve this?

    Thank you!!!!

  • The topic ‘Send new password to a new database after password change/reset’ is closed to new replies.