Make WordPress Core

Ticket #21459: 21459.7.diff

File 21459.7.diff, 1.4 KB (added by joostdekeijzer, 12 years ago)
  • wp-includes/ms-blogs.php

     
    476476        $prev_blog_id = $GLOBALS['blog_id'];
    477477        $GLOBALS['blog_id'] = $new_blog;
    478478
    479         if ( did_action( 'init' ) ) {
    480                 $wp_roles->reinit();
    481                 $current_user = wp_get_current_user();
    482                 $current_user->for_blog( $new_blog );
    483         }
    484 
    485479        if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
    486480                wp_cache_switch_to_blog( $new_blog );
    487481        } else {
     
    503497                }
    504498        }
    505499
     500        if ( did_action( 'init' ) ) {
     501                $wp_roles->reinit();
     502                $current_user = wp_get_current_user();
     503                $current_user->for_blog( $new_blog );
     504        }
     505
    506506        do_action( 'switch_blog', $new_blog, $prev_blog_id );
    507507        $GLOBALS['switched'] = true;
    508508
     
    537537        $GLOBALS['blog_id'] = $blog;
    538538        $GLOBALS['table_prefix'] = $wpdb->prefix;
    539539
    540         if ( did_action( 'init' ) ) {
    541                 $wp_roles->reinit();
    542                 $current_user = wp_get_current_user();
    543                 $current_user->for_blog( $blog );
    544         }
    545 
    546540        if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
    547541                wp_cache_switch_to_blog( $blog );
    548542        } else {
     
    564558                }
    565559        }
    566560
     561        if ( did_action( 'init' ) ) {
     562                $wp_roles->reinit();
     563                $current_user = wp_get_current_user();
     564                $current_user->for_blog( $blog );
     565        }
     566
    567567        do_action( 'switch_blog', $blog, $prev_blog_id );
    568568
    569569        // If we still have items in the switched stack, consider ourselves still 'switched'