mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Fix WP_User::remove_role(). See #10285
git-svn-id: http://svn.automattic.com/wordpress/trunk@13784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bc60e6967a
commit
6ff82f54e7
@ -581,11 +581,12 @@ class WP_User {
|
||||
* @param string $role Role name.
|
||||
*/
|
||||
function remove_role( $role ) {
|
||||
if ( empty( $this->roles[$role] ) || ( count( $this->roles ) <= 1 ) )
|
||||
if ( !in_array($role, $this->roles) )
|
||||
return;
|
||||
unset( $this->caps[$role] );
|
||||
update_user_meta( $this->ID, $this->cap_key, $this->caps );
|
||||
$this->get_role_caps();
|
||||
$this->update_user_level_from_caps();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user