WordPress.org

Make WordPress Core

Ticket #24771: 24771.2.diff

File 24771.2.diff, 1.0 KB (added by martythornley, 7 years ago)

Adds filter 'wp_authenticate_user_for_blog'

  • wp-includes/user.php

     
    9393                // Is user marked as spam?
    9494                if ( 1 == $user->spam )
    9595                        return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.' ) );
     96               
     97                $wp_authenticate_user_for_blog = apply_filters( 'wp_authenticate_user_for_blog' , false , $user->ID, $user->primary_blog );
    9698
    9799                // Is a user's blog marked as spam?
    98                 if ( !is_super_admin( $user->ID ) && isset( $user->primary_blog ) ) {
     100            if ( $wp_authenticate_user_for_blog && ! is_super_admin( $user->ID ) && isset( $user->primary_blog ) && is_user_member_of_blog( $user->ID, $user->primary_blog ) ) {
    99101                        $details = get_blog_details( $user->primary_blog );
    100                         if ( is_object( $details ) && $details->spam == 1 )
     102                        if ( is_object( $details ) && $details->spam == 1 )                     
    101103                                return new WP_Error( 'blog_suspended', __( 'Site Suspended.' ) );
    102104                }
    103105        }