WordPress.org

Make WordPress Core

Ticket #19134: roleaction.diff

File roleaction.diff, 708 bytes (added by awellis13, 7 years ago)
  • wp-includes/capabilities.php

     
    724724                if ( 1 == count( $this->roles ) && $role == $this->roles[0] )
    725725                        return;
    726726
     727                $oldroles = $this->roles;
    727728                if ( !empty( $role ) ) {
    728729                        $this->caps[$role] = true;
    729730                        $this->roles = array( $role => true );
     
    733734                update_user_meta( $this->ID, $this->cap_key, $this->caps );
    734735                $this->get_role_caps();
    735736                $this->update_user_level_from_caps();
    736                 do_action( 'set_user_role', $this->ID, $role );
     737                do_action( 'set_user_role', $this->ID, $role, $oldroles );
    737738        }
    738739
    739740        /**