WordPress.org

Make WordPress Core

Changeset 22087


Ignore:
Timestamp:
10/01/12 14:25:31 (3 years ago)
Author:
ryan
Message:

Reinit roles and the current user after switching the cache to the new blog in switch_to_blog() and restore_current_blog(). Props joostdekeijzer. fixes #21459

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r22080 r22087  
    264264        elseif ( 'approve' == $status ) 
    265265            $approved = "comment_approved = '1'"; 
     266        elseif ( 'all' == $status ) 
     267            $approved = "( comment_approved = '0' OR comment_approved = '1' )"; 
     268        elseif ( 'full' == $status ) 
     269            $approved = '0 = 0'; 
    266270        elseif ( ! empty( $status ) ) 
    267271            $approved = $wpdb->prepare( "comment_approved = %s", $status ); 
  • trunk/wp-includes/ms-blogs.php

    r22015 r22087  
    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 ); 
     
    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; 
     
    537537    $GLOBALS['blog_id'] = $blog; 
    538538    $GLOBALS['table_prefix'] = $wpdb->prefix; 
    539  
    540     if ( did_action( 'init' ) ) { 
    541         $wp_roles->reinit(); 
    542         $current_user = wp_get_current_user(); 
    543         $current_user->for_blog( $blog ); 
    544     } 
    545539 
    546540    if ( function_exists( 'wp_cache_switch_to_blog' ) ) { 
     
    563557            wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); 
    564558        } 
     559    } 
     560 
     561    if ( did_action( 'init' ) ) { 
     562        $wp_roles->reinit(); 
     563        $current_user = wp_get_current_user(); 
     564        $current_user->for_blog( $blog ); 
    565565    } 
    566566 
Note: See TracChangeset for help on using the changeset viewer.