WordPress.org

Make WordPress Core

Ticket #14708: set-role.diff

File set-role.diff, 520 bytes (added by nickmomrik, 5 years ago)

Possible fix

  • capabilities.php

     
    604604        function set_role( $role ) { 
    605605                foreach ( (array) $this->roles as $oldrole ) 
    606606                        unset( $this->caps[$oldrole] ); 
     607 
     608                if ( 1 == count( $this->roles ) && $role == $this->roles[0] ) 
     609                        return; 
     610 
    607611                if ( !empty( $role ) ) { 
    608612                        $this->caps[$role] = true; 
    609613                        $this->roles = array( $role => true );