WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-includes/ms-blogs.php

    r15168 r15452  
    372372
    373373function switch_to_blog( $new_blog, $validate = false ) {
    374     global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache;
     374    global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
    375375
    376376    if ( empty($new_blog) )
     
    407407        $wpdb->suppress_errors( false );
    408408    }
    409 
    410     if ( is_object( $current_user ) )
    411         $current_user->for_blog( $blog_id );
     409 
     410    if ( did_action('init') ) {
     411        $current_user = wp_get_current_user(); 
     412        if ( is_object( $current_user ) )
     413            $current_user->for_blog( $blog_id );
     414    }
    412415
    413416    if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )
     
    431434
    432435function restore_current_blog() {
    433     global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache;
     436    global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
    434437
    435438    if ( !$switched )
     
    461464    }
    462465
    463     if ( is_object( $current_user ) )
    464         $current_user->for_blog( $blog_id );
     466    if ( did_action('init') ) {
     467        $current_user = wp_get_current_user();
     468        if ( is_object( $current_user ) )
     469            $current_user->for_blog( $blog_id );
     470    }
    465471
    466472    if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )
Note: See TracChangeset for help on using the changeset viewer.