WordPress.org

Make WordPress Core

Changeset 22354


Ignore:
Timestamp:
10/31/12 23:18:33 (18 months ago)
Author:
dd32
Message:

Fix a PHP Notice when attempting to Add or remove capabilities from nonexistant roles. Props SergeyBiryukov. Fixes #18461

File:
1 edited

Legend:

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

    r22248 r22354  
    207207     */ 
    208208    function add_cap( $role, $cap, $grant = true ) { 
     209        if ( ! isset( $this->roles[$role] ) ) 
     210            return; 
     211 
    209212        $this->roles[$role]['capabilities'][$cap] = $grant; 
    210213        if ( $this->use_db ) 
     
    222225     */ 
    223226    function remove_cap( $role, $cap ) { 
     227        if ( ! isset( $this->roles[$role] ) ) 
     228            return; 
     229 
    224230        unset( $this->roles[$role]['capabilities'][$cap] ); 
    225231        if ( $this->use_db ) 
Note: See TracChangeset for help on using the changeset viewer.