From 037fae5ae6c91c79d6ca1c5f63e868efbdf45d51 Mon Sep 17 00:00:00 2001 From: westi Date: Thu, 4 Nov 2010 09:31:58 +0000 Subject: [PATCH] Don't mangle the primary_blog option when trying to fix it. Don't set people to be a subscriber on a blog they already have a role for. See #15316 git-svn-id: http://svn.automattic.com/wordpress/trunk@16179 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-functions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 462678e96..ee4c8d097 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -79,17 +79,17 @@ function get_active_blog_for_user( $user_id ) { $primary_blog = get_user_meta( $user_id, 'primary_blog', true ); $first_blog = current($blogs); - if ( $primary_blog ) { + if ( false !== $primary_blog ) { if ( ! isset( $blogs[ $primary_blog ] ) ) { - add_user_to_blog( $first_blog->blog_id, $user_id, 'subscriber' ); - update_user_meta( $user_id, 'primary_blog', $first_blog->blog_id ); + update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id ); $primary = $first_blog; } else { $primary = get_blog_details( $primary_blog ); } } else { - add_user_to_blog( $first_blog->blog_id, $user_id, 'subscriber' ); - update_user_meta( $user_id, 'primary_blog', $first_blog->blog_id ); + //TODO Review this call to add_user_to_blog too - to get here the user must have a role on this blog? + add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' ); + update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id ); $primary = $first_blog; }