WordPress.org

Make WordPress Core

Ticket #24771: 24771.3.diff

File 24771.3.diff, 1.8 KB (added by brianhogg, 7 years ago)

Removes check for user blog as spam when logging in, adds replacement filter

  • wp-includes/user.php

     
    9090                return new WP_Error( 'invalid_username', sprintf( __( '<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?' ), wp_lostpassword_url() ) );
    9191
    9292        if ( is_multisite() ) {
    93                 // Is user marked as spam?
    94                 if ( 1 == $user->spam )
     93                $spammed = is_user_spammy( $user );
     94        $spammed = apply_filters( 'check_is_user_spammed', $spammed, $user );
     95        if ( is_wp_error( $spammed ) )
     96            return $spammed;
     97        elseif ( $spammed )
    9598                        return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.' ) );
    96 
    97                 // Is a user's blog marked as spam?
    98                 if ( !is_super_admin( $user->ID ) && isset( $user->primary_blog ) ) {
    99                         $details = get_blog_details( $user->primary_blog );
    100                         if ( is_object( $details ) && $details->spam == 1 )
    101                                 return new WP_Error( 'blog_suspended', __( 'Site Suspended.' ) );
    102                 }
    10399        }
    104100
    105101        $user = apply_filters('wp_authenticate_user', $user, $password);
  • wp-includes/ms-functions.php

     
    17051705 * @since MU
    17061706 * @uses get_user_by()
    17071707 *
    1708  * @param string $user_login Optional. Defaults to current user.
     1708 * @param string|WP_User $user_login Optional. Defaults to current user.
    17091709 * @return bool
    17101710 */
    17111711function is_user_spammy( $user_login = null ) {
    1712         if ( $user_login )
     1712    if ( $user_login instanceof WP_User )
     1713        $user = $user_login;
     1714        elseif ( $user_login )
    17131715                $user = get_user_by( 'login', $user_login );
    17141716        else
    17151717                $user = wp_get_current_user();