Ticket #36961: 36961.diff
File 36961.diff, 1.0 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-wp-user.php
480 480 * @return array List of all capabilities for the user. 481 481 */ 482 482 public function get_role_caps() { 483 $switch_site = false; 484 if ( is_multisite() && $this->db->get_blog_prefix() . 'capabilities' !== $this->cap_key ) { 485 $base_prefix = $this->db->get_blog_prefix( 1 ); 486 if ( $base_prefix . 'capabilities' === $this->cap_key ) { 487 $switch_site = 1; 488 } else { 489 $switch_site = absint( substr( $this->cap_key, strlen( $base_prefix ), - strlen( '_capabilities' ) ) ); 490 } 491 492 switch_to_blog( $switch_site ); 493 } 494 483 495 $wp_roles = wp_roles(); 484 496 485 497 //Filter out caps that are not role names and assign to $this->roles … … 494 506 } 495 507 $this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps ); 496 508 509 if ( $switch_site ) { 510 restore_current_blog(); 511 } 512 497 513 return $this->allcaps; 498 514 } 499 515