WordPress.org

Make WordPress Core

Ticket #22803: 22803.2.diff

File 22803.2.diff, 1.2 KB (added by markjaquith, 5 years ago)
  • wp-includes/capabilities.php

    function current_user_can( $capability ) { 
    12991299 * @return bool
    13001300 */
    13011301function current_user_can_for_blog( $blog_id, $capability ) {
    1302         switch_to_blog( $blog_id );
     1302        if ( is_multisite() )
     1303                switch_to_blog( $blog_id );
    13031304
    13041305        $current_user = wp_get_current_user();
    13051306
    function current_user_can_for_blog( $blog_id, $capability ) { 
    13111312
    13121313        $can = call_user_func_array( array( $current_user, 'has_cap' ), $args );
    13131314
    1314         restore_current_blog();
     1315        if ( is_multisite() )
     1316                restore_current_blog();
    13151317
    13161318        return $can;
    13171319}
  • wp-includes/class-wp-theme.php

    final class WP_Theme implements ArrayAccess { 
    11041104        public static function get_allowed_on_site( $blog_id = null ) {
    11051105                static $allowed_themes = array();
    11061106
    1107                 if ( ! $blog_id )
     1107                if ( ! $blog_id || ! is_multisite() )
    11081108                        $blog_id = get_current_blog_id();
    11091109
    11101110                if ( isset( $allowed_themes[ $blog_id ] ) )