get_password_reset_key example


        $send_notification_to_user = apply_filters( 'wp_send_new_user_notification_to_user', true, $user );

        // `$deprecated` was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notification.         if ( 'admin' === $notify || true !== $send_notification_to_user || ( empty( $deprecated ) && empty( $notify ) ) ) {
            return;
        }

        $key = get_password_reset_key( $user );
        if ( is_wp_error( $key ) ) {
            return;
        }

        $switched_locale = switch_to_user_locale( $user_id );

        /* translators: %s: User login. */
        $message  = sprintf( __( 'Username: %s' )$user->user_login ) . "\r\n\r\n";
        $message .= __( 'To set your password, visit the following address:' ) . "\r\n\r\n";
        $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user->user_login ), 'login' ) . "\r\n\r\n";

        

    if ( ! apply_filters( 'send_retrieve_password_email', true, $user_login$user_data ) ) {
        return true;
    }

    // Redefining user_login ensures we return the right case in the email.     $user_login = $user_data->user_login;
    $user_email = $user_data->user_email;
    $key        = get_password_reset_key( $user_data );

    if ( is_wp_error( $key ) ) {
        return $key;
    }

    // Localize password reset message content for user.     $locale = get_user_locale( $user_data );

    $switched_locale = switch_to_user_locale( $user_data->ID );

    if ( is_multisite() ) {
        
Home | Imprint | This part of the site doesn't use cookies.