Fix WP_User::remove_role(). See #10285
git-svn-id: https://develop.svn.wordpress.org/trunk@13784 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cf430f20d0
commit
f24da9abad
@ -581,11 +581,12 @@ class WP_User {
|
|||||||
* @param string $role Role name.
|
* @param string $role Role name.
|
||||||
*/
|
*/
|
||||||
function remove_role( $role ) {
|
function remove_role( $role ) {
|
||||||
if ( empty( $this->roles[$role] ) || ( count( $this->roles ) <= 1 ) )
|
if ( !in_array($role, $this->roles) )
|
||||||
return;
|
return;
|
||||||
unset( $this->caps[$role] );
|
unset( $this->caps[$role] );
|
||||||
update_user_meta( $this->ID, $this->cap_key, $this->caps );
|
update_user_meta( $this->ID, $this->cap_key, $this->caps );
|
||||||
$this->get_role_caps();
|
$this->get_role_caps();
|
||||||
|
$this->update_user_level_from_caps();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user