Ticket #40513: 40513.3.diff
File 40513.3.diff, 6.5 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/class-wp-ms-sites-list-table.php
330 330 </strong> 331 331 <?php 332 332 if ( 'list' !== $mode ) { 333 switch_to_blog( $blog['blog_id']);333 switch_to_blog( get_site( $blog['blog_id'] ) ); 334 334 echo '<p>'; 335 335 printf( 336 336 /* translators: 1: site name, 2: site tagline. */ -
src/wp-admin/includes/ms.php
231 231 232 232 if ( ! empty( $blogs ) ) { 233 233 foreach ( $blogs as $blog ) { 234 switch_to_blog( $blog->userblog_id);234 switch_to_blog( get_site( $blog ) ); 235 235 remove_user_from_blog( $id, $blog->userblog_id ); 236 236 237 237 $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) ); -
src/wp-admin/network/site-themes.php
69 69 $is_main_site = is_main_site( $id ); 70 70 71 71 if ( $action ) { 72 switch_to_blog( $ id);72 switch_to_blog( $details ); 73 73 $allowed_themes = get_option( 'allowedthemes' ); 74 74 75 75 switch ( $action ) { -
src/wp-admin/network/site-users.php
61 61 62 62 $is_main_site = is_main_site( $id ); 63 63 64 switch_to_blog( $ id);64 switch_to_blog( $details ); 65 65 66 66 $action = $wp_list_table->current_action(); 67 67 -
src/wp-includes/admin-bar.php
508 508 ) ); 509 509 510 510 foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { 511 switch_to_blog( $blog->userblog_id);511 switch_to_blog( get_site( $blog ) ); 512 512 513 513 $blavatar = '<div class="blavatar"></div>'; 514 514 -
src/wp-includes/class-wp-site.php
334 334 335 335 if ( false === $details ) { 336 336 337 switch_to_blog( $this ->blog_id);337 switch_to_blog( $this ); 338 338 // Create a raw copy of the object for backwards compatibility with the filter below. 339 339 $details = new stdClass(); 340 340 foreach ( get_object_vars( $this ) as $key => $value ) { -
src/wp-includes/class-wp-xmlrpc-server.php
632 632 continue; 633 633 634 634 $blog_id = $blog->userblog_id; 635 636 switch_to_blog( $ blog_id);635 $site = get_site( $blog ); 636 switch_to_blog( $site ); 637 637 638 638 $is_admin = current_user_can( 'manage_options' ); 639 639 $is_primary = ( (int) $blog_id === $primary_blog_id ); -
src/wp-includes/ms-blogs.php
229 229 return $details; 230 230 } 231 231 232 switch_to_blog( $ blog_id);232 switch_to_blog( $details ); 233 233 $details->blogname = get_option( 'blogname' ); 234 234 $details->siteurl = get_option( 'siteurl' ); 235 235 $details->post_count = get_option( 'post_count' ); … … 788 788 * @global string $table_prefix 789 789 * @global WP_Object_Cache $wp_object_cache 790 790 * 791 * @param int $new_blog The id of the blog you want to switch to. Default: current blog791 * @param WP_Site|int $new_blog The id of the blog you want to switch to. Default: current blog 792 792 * @param bool $deprecated Deprecated argument 793 793 * @return true Always returns True. 794 794 */ … … 796 796 global $wpdb, $wp_roles; 797 797 798 798 $blog_id = get_current_blog_id(); 799 $site_object = false; 799 800 if ( empty( $new_blog ) ) { 800 801 $new_blog = $blog_id; 802 } else if ( $new_blog instanceof WP_Site ) { 803 $site_object = $new_blog; 804 $new_blog = $site_object->blog_id; 801 805 } 802 806 803 807 $GLOBALS['_wp_switched_stack'][] = $blog_id; … … 815 819 * 816 820 * @param int $new_blog New blog ID. 817 821 * @param int $new_blog Blog ID. 822 * @param WP_Site $site_object Optional Site object. 818 823 */ 819 do_action( 'switch_blog', $new_blog, $new_blog );824 do_action( 'switch_blog', $new_blog, $new_blog, $site_object ); 820 825 $GLOBALS['switched'] = true; 821 826 return true; 822 827 } … … 855 860 } 856 861 857 862 /** This filter is documented in wp-includes/ms-blogs.php */ 858 do_action( 'switch_blog', $new_blog, $prev_blog_id );863 do_action( 'switch_blog', $new_blog, $prev_blog_id, $site_object ); 859 864 $GLOBALS['switched'] = true; 860 865 861 866 return true; … … 877 882 * @return bool True on success, false if we're already on the current blog 878 883 */ 879 884 function restore_current_blog() { 880 global $wpdb, $wp_roles ;885 global $wpdb, $wp_roles, $current_blog; 881 886 882 887 if ( empty( $GLOBALS['_wp_switched_stack'] ) ) { 883 888 return false; … … 888 893 889 894 if ( $blog_id == $blog ) { 890 895 /** This filter is documented in wp-includes/ms-blogs.php */ 891 do_action( 'switch_blog', $blog, $blog );896 do_action( 'switch_blog', $blog, $blog, $current_blog ); 892 897 // If we still have items in the switched stack, consider ourselves still 'switched' 893 898 $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); 894 899 return true; … … 929 934 } 930 935 931 936 /** This filter is documented in wp-includes/ms-blogs.php */ 932 do_action( 'switch_blog', $blog, $prev_blog_id );937 do_action( 'switch_blog', $blog, $prev_blog_id, $current_blog ); 933 938 934 939 // If we still have items in the switched stack, consider ourselves still 'switched' 935 940 $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); -
src/wp-includes/ms-functions.php
1170 1170 if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) 1171 1171 return new WP_Error('insert_blog', __('Could not create site.')); 1172 1172 1173 switch_to_blog( $blog_id);1173 switch_to_blog( get_site( $blog_id ) ); 1174 1174 install_blog($blog_id, $title); 1175 1175 wp_install_defaults($user_id); 1176 1176