From 65ac9b68271d5ed36be7e6bc6a5721f6919fefd2 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 27 Jan 2010 18:11:17 +0000 Subject: [PATCH] Integrate wordpressmu_authenticate_siteadmin() into wp_authenticate_username_password(). see #11644 git-svn-id: http://svn.automattic.com/wordpress/trunk@12879 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-default-filters.php | 1 - wp-includes/ms-functions.php | 9 --------- wp-includes/user.php | 14 ++++++++++++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wp-includes/ms-default-filters.php b/wp-includes/ms-default-filters.php index d574c88820..c05ed88092 100644 --- a/wp-includes/ms-default-filters.php +++ b/wp-includes/ms-default-filters.php @@ -2,7 +2,6 @@ // Users add_filter ( 'wpmu_validate_user_signup', 'signup_nonce_check' ); add_action ( 'init', 'maybe_add_existing_user_to_blog' ); -add_filter ( 'wp_authenticate_user', 'wordpressmu_authenticate_siteadmin', 10, 2 ); add_action ( 'wpmu_new_user', 'newuser_notify_siteadmin' ); add_action ( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 ); add_action ( 'sanitize_user', 'strtolower_usernames', 10, 3 ); diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 8693588eac..5c17cd0dc0 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -1747,15 +1747,6 @@ function upload_is_file_too_big( $upload ) { return $upload; } -function wordpressmu_authenticate_siteadmin( $user, $password = '' ) { - if ( is_super_admin( $user->user_login ) == false && ( $primary_blog = get_usermeta( $user->user_id, "primary_blog" ) ) ) { - $details = get_blog_details( $primary_blog ); - if ( is_object( $details ) && $details->spam == 1 ) - return new WP_Error('blog_suspended', __('Blog Suspended.')); - } - return $user; -} - function wordpressmu_wp_mail_from( $email ) { if ( strpos( $email, 'wordpress@' ) !== false ) $email = get_option( 'admin_email' ); diff --git a/wp-includes/user.php b/wp-includes/user.php index bc84943cda..4609f0eaf3 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -88,8 +88,18 @@ function wp_authenticate_username_password($user, $username, $password) { if ( !$userdata ) return new WP_Error('invalid_username', sprintf(__('ERROR: Invalid username. Lost your password?'), site_url('wp-login.php?action=lostpassword', 'login'))); - if ( is_multisite() && (1 == $userdata->spam) ) - return new WP_Error('invalid_username', __('ERROR: Your account has been marked as a spammer.')); + if ( is_multisite() ) { + // Is user marked as spam? + if ( 1 == $userdata->spam) + return new WP_Error('invalid_username', __('ERROR: Your account has been marked as a spammer.')); + + // Is a user's blog marked as spam? + if ( !is_super_admin( $userdata->ID ) && isset($userdata->primary_blog) ) { + $details = get_blog_details( $userdata->primary_blog ); + if ( is_object( $details ) && $details->spam == 1 ) + return new WP_Error('blog_suspended', __('Blog Suspended.')); + } + } $userdata = apply_filters('wp_authenticate_user', $userdata, $password); if ( is_wp_error($userdata) )