From f4e8cf9bb6fe2f7de5a16b5e9180e579128cffa4 Mon Sep 17 00:00:00 2001 From: PeteMall Date: Tue, 30 Nov 2010 20:45:40 +0000 Subject: [PATCH] Address redirection loop with multiple networks and network admin. Props mwidmann, fixes #15591 git-svn-id: http://svn.automattic.com/wordpress/trunk@16633 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-settings.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/ms-settings.php b/wp-includes/ms-settings.php index 43724621a..9022313e5 100644 --- a/wp-includes/ms-settings.php +++ b/wp-includes/ms-settings.php @@ -59,9 +59,11 @@ if ( !isset( $current_site ) || !isset( $current_blog ) ) { if ( $current_blog ) wp_cache_set( 'current_blog_' . $domain, $current_blog, 'site-options' ); } - if ( $current_blog && $current_blog->site_id != $current_site->id ) + if ( $current_blog && $current_blog->site_id != $current_site->id ) { $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE id = %d", $current_blog->site_id ) ); - else + if ( ! isset( $current_site->blog_id ) ) + $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) ); + } else $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); } else { $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) );