From ec5a6fcbb43edab5f47848577735cf38e0bb8c7a Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Wed, 10 Feb 2010 17:50:26 +0000 Subject: [PATCH] add option to validate on switch_to_blog, see #12023 git-svn-id: https://develop.svn.wordpress.org/trunk@13047 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/ms-functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 8cf0b837ac..ddd8bebb8e 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -310,12 +310,15 @@ function update_blog_option( $id, $key, $value, $refresh = true ) { wp_cache_set( $id."-".$key."-blog_option", $value, 'site-options'); } -function switch_to_blog( $new_blog ) { +function switch_to_blog( $new_blog, $validate = false ) { global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache; if ( empty($new_blog) ) $new_blog = $blog_id; + if ( $validate && ! get_blog_details( $new_blog ) ) + return false; + if ( empty($switched_stack) ) $switched_stack = array();