Changeset 41625 for trunk/src/wp-includes/ms-blogs.php
- Timestamp:
- 09/27/2017 09:43:59 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-blogs.php
r41624 r41625 793 793 */ 794 794 function switch_to_blog( $new_blog, $deprecated = null ) { 795 global $wpdb , $wp_roles;795 global $wpdb; 796 796 797 797 $blog_id = get_current_blog_id(); … … 848 848 } 849 849 850 if ( did_action( 'init' ) ) {851 $wp_roles = new WP_Roles();852 $current_user = wp_get_current_user();853 $current_user->for_site( $new_blog );854 }855 856 850 /** This filter is documented in wp-includes/ms-blogs.php */ 857 851 do_action( 'switch_blog', $new_blog, $prev_blog_id ); … … 877 871 */ 878 872 function restore_current_blog() { 879 global $wpdb , $wp_roles;873 global $wpdb; 880 874 881 875 if ( empty( $GLOBALS['_wp_switched_stack'] ) ) { … … 922 916 } 923 917 924 if ( did_action( 'init' ) ) {925 $wp_roles = new WP_Roles();926 $current_user = wp_get_current_user();927 $current_user->for_site( $blog );928 }929 930 918 /** This filter is documented in wp-includes/ms-blogs.php */ 931 919 do_action( 'switch_blog', $blog, $prev_blog_id ); … … 935 923 936 924 return true; 925 } 926 927 /** 928 * Switches the initialized roles and current user capabilities to another site. 929 * 930 * @since 4.9.0 931 * 932 * @param int $new_site_id New site ID. 933 * @param int $old_site_id Old site ID. 934 */ 935 function wp_switch_roles_and_user( $new_site_id, $old_site_id ) { 936 if ( $new_site_id == $old_site_id ) { 937 return; 938 } 939 940 if ( ! did_action( 'init' ) ) { 941 return; 942 } 943 944 wp_roles()->for_site( $new_site_id ); 945 wp_get_current_user()->for_site( $new_site_id ); 937 946 } 938 947
Note: See TracChangeset
for help on using the changeset viewer.