Do not set role if it is the same. Props nickmomrik. fixes #14708
git-svn-id: https://develop.svn.wordpress.org/trunk@15919 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f2dbc7d273
commit
efdb066697
@ -605,6 +605,10 @@ class WP_User {
|
||||
function set_role( $role ) {
|
||||
foreach ( (array) $this->roles as $oldrole )
|
||||
unset( $this->caps[$oldrole] );
|
||||
|
||||
if ( 1 == count( $this->roles ) && $role == $this->roles[0] )
|
||||
return;
|
||||
|
||||
if ( !empty( $role ) ) {
|
||||
$this->caps[$role] = true;
|
||||
$this->roles = array( $role => true );
|
||||
|
Loading…
Reference in New Issue
Block a user