Ticket #23746: 23746.3.diff
| File 23746.3.diff, 1.7 KB (added by , 10 years ago) |
|---|
-
src/wp-includes/capabilities-functions.php
442 442 function wp_roles() { 443 443 global $wp_roles; 444 444 445 446 445 447 if ( ! isset( $wp_roles ) ) { 446 448 $wp_roles = new WP_Roles(); 447 449 } … … 471 473 * @return WP_Role|null WP_Role object if role is added, null if already exists. 472 474 */ 473 475 function add_role( $role, $display_name, $capabilities = array() ) { 476 477 if ( empty( $role ) ) { 478 return; 479 } 480 474 481 return wp_roles()->add_role( $role, $display_name, $capabilities ); 475 482 } 476 483 -
src/wp-includes/class-wp-roles.php
172 172 * @return WP_Role|void WP_Role object, if role is added. 173 173 */ 174 174 public function add_role( $role, $display_name, $capabilities = array() ) { 175 if ( isset( $this->roles[$role] ) ) 175 176 if ( empty( $role ) || isset( $this->roles[$role] ) ) { 176 177 return; 178 } 177 179 178 180 $this->roles[$role] = array( 179 181 'name' => $display_name, -
src/wp-includes/class-wp-user.php
436 436 * @param string $role Role name. 437 437 */ 438 438 public function add_role( $role ) { 439 440 if ( empty( $role ) ) { 441 return; 442 } 443 439 444 $this->caps[$role] = true; 440 445 update_user_meta( $this->ID, $this->cap_key, $this->caps ); 441 446 $this->get_role_caps();