Make WordPress Core


Ignore:
Timestamp:
02/27/2018 02:30:46 AM (7 years ago)
Author:
SergeyBiryukov
Message:

General: Introduce WP_Error::has_errors() method and use it where appropriate.

Props robdxw, DrewAPicture, SergeyBiryukov.
Fixes #42742.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-login.php

    r42406 r42761  
    5454    $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
    5555
    56     if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) {
     56    if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) {
    5757        add_action( 'login_head', 'wp_shake_js', 12 );
    5858    }
     
    209209    }
    210210
    211     if ( $wp_error->get_error_code() ) {
     211    if ( $wp_error->has_errors() ) {
    212212        $errors   = '';
    213213        $messages = '';
     
    342342    do_action( 'lostpassword_post', $errors );
    343343
    344     if ( $errors->get_error_code() ) {
     344    if ( $errors->has_errors() ) {
    345345        return $errors;
    346346    }
     
    688688        do_action( 'validate_password_reset', $errors, $user );
    689689
    690         if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) {
     690        if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) {
    691691            reset_password( $user, $_POST['pass1'] );
    692692            setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
     
    974974
    975975        if ( $interim_login ) {
    976             if ( ! $errors->get_error_code() ) {
     976            if ( ! $errors->has_errors() ) {
    977977                $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' );
    978978            }
     
    10161016        $rememberme = ! empty( $_POST['rememberme'] );
    10171017
    1018         if ( ! empty( $errors->errors ) ) {
     1018        if ( $errors->has_errors() ) {
    10191019            $aria_describedby_error = ' aria-describedby="login_error"';
    10201020        } else {
Note: See TracChangeset for help on using the changeset viewer.