restore_current_blog() in add_user_to_blog() and remove_user_from_blog() before early return, to avoid being stuck in a switched state. props mdawaffe. fixes #16444 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@17379 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
17c837ee67
commit
5b5b5e7747
@ -209,8 +209,10 @@ function add_user_to_blog( $blog_id, $user_id, $role ) {
|
||||
|
||||
$user = new WP_User($user_id);
|
||||
|
||||
if ( empty( $user->ID ) )
|
||||
if ( empty( $user->ID ) ) {
|
||||
restore_current_blog();
|
||||
return new WP_Error('user_does_not_exist', __('That user does not exist.'));
|
||||
}
|
||||
|
||||
if ( !get_user_meta($user_id, 'primary_blog', true) ) {
|
||||
update_user_meta($user_id, 'primary_blog', $blog_id);
|
||||
@ -269,8 +271,10 @@ function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') {
|
||||
|
||||
// wp_revoke_user($user_id);
|
||||
$user = new WP_User($user_id);
|
||||
if ( empty( $user->ID ) )
|
||||
if ( empty( $user->ID ) ) {
|
||||
restore_current_blog();
|
||||
return new WP_Error('user_does_not_exist', __('That user does not exist.'));
|
||||
}
|
||||
|
||||
$user->remove_all_caps();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user