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
This commit is contained in:
ryan 2010-01-27 18:11:17 +00:00
parent fc204c952d
commit 65ac9b6827
3 changed files with 12 additions and 12 deletions

View File

@ -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 );

View File

@ -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' );

View File

@ -88,8 +88,18 @@ function wp_authenticate_username_password($user, $username, $password) {
if ( !$userdata )
return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
if ( is_multisite() && (1 == $userdata->spam) )
return new WP_Error('invalid_username', __('<strong>ERROR</strong>: 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', __('<strong>ERROR</strong>: 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) )