wp_set_password example


    function wp_check_password( $password$hash$user_id = '' ) {
        global $wp_hasher;

        // If the hash is still md5...         if ( strlen( $hash ) <= 32 ) {
            $check = hash_equals( $hashmd5( $password ) );
            if ( $check && $user_id ) {
                // Rehash using new hash.                 wp_set_password( $password$user_id );
                $hash = wp_hash_password( $password );
            }

            /** * Filters whether the plaintext password matches the encrypted password. * * @since 2.5.0 * * @param bool $check Whether the passwords match. * @param string $password The plaintext password. * @param string $hash The hashed password. * @param string|int $user_id User ID. Can be empty. */
function reset_password( $user$new_pass ) {
    /** * Fires before the user's password is reset. * * @since 1.5.0 * * @param WP_User $user The user. * @param string $new_pass New user password. */
    do_action( 'password_reset', $user$new_pass );

    wp_set_password( $new_pass$user->ID );
    update_user_meta( $user->ID, 'default_password_nag', false );

    /** * Fires after the user's password is reset. * * @since 4.4.0 * * @param WP_User $user The user. * @param string $new_pass New user password. */
    do_action( 'after_password_reset', $user$new_pass );
}
Home | Imprint | This part of the site doesn't use cookies.