Do not set role if it is the same. Props nickmomrik. fixes #14708
git-svn-id: http://svn.automattic.com/wordpress/trunk@15919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
62003eb20f
commit
e1a7cc966f
|
@ -605,6 +605,10 @@ class WP_User {
|
||||||
function set_role( $role ) {
|
function set_role( $role ) {
|
||||||
foreach ( (array) $this->roles as $oldrole )
|
foreach ( (array) $this->roles as $oldrole )
|
||||||
unset( $this->caps[$oldrole] );
|
unset( $this->caps[$oldrole] );
|
||||||
|
|
||||||
|
if ( 1 == count( $this->roles ) && $role == $this->roles[0] )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( !empty( $role ) ) {
|
if ( !empty( $role ) ) {
|
||||||
$this->caps[$role] = true;
|
$this->caps[$role] = true;
|
||||||
$this->roles = array( $role => true );
|
$this->roles = array( $role => true );
|
||||||
|
|
Loading…
Reference in New Issue