WordPress.org

Make WordPress Core

Ticket #36546: 36546.02.patch

File 36546.02.patch, 1.7 KB (added by websupporter, 4 years ago)

Changed the error message to a more generic Your account has been disabled and merged it together with #24617 (dont know, if this is a good practice, but since they are quite related)

  • src/wp-includes/user.php

     
    302302                 * @param bool    $spammed Whether the user is considered a spammer.
    303303                 * @param WP_User $user    User to check against.
    304304                 */
    305                 $spammed = apply_filters( 'check_is_user_spammed', is_user_spammy(), $user );
     305                $spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user );
    306306
    307307                if ( $spammed )
    308                         return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.' ) );
     308                        return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been disabled.' ) );
    309309        }
    310310        return $user;
    311311}
     
    20362036         */
    20372037        do_action( 'retrieve_password', $user->user_login );
    20382038
     2039        $allow = true;
     2040        if ( is_multisite() && is_user_spammy( $user ) ) {
     2041                $allow = false;
     2042        }
     2043
    20392044        /**
    20402045         * Filter whether to allow a password to be reset.
    20412046         *
    20422047         * @since 2.7.0
    20432048         *
    2044          * @param bool $allow         Whether to allow the password to be reset. Default true.
    2045          * @param int  $user_data->ID The ID of the user attempting to reset a password.
     2049         * @param bool    $allow    Whether to allow the password to be reset. Default true.
     2050         * @param int     $user->ID The ID of the user attempting to reset a password.
     2051         * @param WP_User $user     The WP_User object of the user attempting to reset a password.
    20462052         */
    2047         $allow = apply_filters( 'allow_password_reset', true, $user->ID );
     2053        $allow = apply_filters( 'allow_password_reset', $allow, $user->ID, $user );
    20482054
    20492055        if ( ! $allow ) {
    20502056                return new WP_Error( 'no_password_reset', __( 'Password reset is not allowed for this user' ) );