Make WordPress Core

Changeset 22418


Ignore:
Timestamp:
11/07/2012 05:16:37 PM (12 years ago)
Author:
ryan
Message:

When using WP_User::set_role() to set the role, don't unset all caps when the requested role matches the current role.

Props scribu, jammitch
fixes #18932

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r22354 r22418  
    798798     */
    799799    function set_role( $role ) {
     800        if ( 1 == count( $this->roles ) && $role == current( $this->roles ) )
     801            return;
     802
    800803        foreach ( (array) $this->roles as $oldrole )
    801804            unset( $this->caps[$oldrole] );
    802 
    803         if ( 1 == count( $this->roles ) && $role == current( $this->roles ) )
    804             return;
    805805
    806806        if ( !empty( $role ) ) {
Note: See TracChangeset for help on using the changeset viewer.