Index: wp-signup.php
===================================================================
--- wp-signup.php	(revision 15270)
+++ wp-signup.php	(working copy)
@@ -153,7 +153,8 @@
 }
 
 function signup_another_blog($blogname = '', $blog_title = '', $errors = '') {
-	global $current_user, $current_site;
+	global $current_site;
+	$current_user = wp_get_current_user();
 
 	if ( ! is_wp_error($errors) ) {
 		$errors = new WP_Error();
@@ -197,7 +198,7 @@
 }
 
 function validate_another_blog_signup() {
-	global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path;
+	global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
 	$current_user = wp_get_current_user();
 	if ( !is_user_logged_in() )
 		die();
Index: wp-includes/ms-blogs.php
===================================================================
--- wp-includes/ms-blogs.php	(revision 15270)
+++ wp-includes/ms-blogs.php	(working copy)
@@ -371,7 +371,7 @@
 }
 
 function switch_to_blog( $new_blog, $validate = false ) {
-	global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache;
+	global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
 
 	if ( empty($new_blog) )
 		$new_blog = $blog_id;
@@ -406,7 +406,8 @@
 			$wp_roles->__construct();
 		$wpdb->suppress_errors( false );
 	}
-
+ 
+	$current_user = wp_get_current_user();
 	if ( is_object( $current_user ) )
 		$current_user->for_blog( $blog_id );
 
@@ -430,7 +431,7 @@
 }
 
 function restore_current_blog() {
-	global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache;
+	global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
 
 	if ( !$switched )
 		return false;
@@ -460,6 +461,7 @@
 		$wpdb->suppress_errors( false );
 	}
 
+	$current_user = wp_get_current_user();
 	if ( is_object( $current_user ) )
 		$current_user->for_blog( $blog_id );
 
Index: wp-includes/ms-functions.php
===================================================================
--- wp-includes/ms-functions.php	(revision 15270)
+++ wp-includes/ms-functions.php	(working copy)
@@ -372,8 +372,9 @@
 }
 
 function is_blog_user( $blog_id = 0 ) {
-	global $current_user, $wpdb;
-
+	global $wpdb;
+ 
+	$current_user = wp_get_current_user();
 	if ( !$blog_id )
 		$blog_id = $wpdb->blogid;
 
@@ -1319,8 +1320,7 @@
 
 function is_user_spammy( $username = 0 ) {
 	if ( $username == 0 ) {
-		global $current_user;
-		$user_id = $current_user->ID;
+		$user_id = get_current_user_id();
 	} else {
 		$user_id = get_user_id_from_string( $username );
 	}
@@ -1360,8 +1360,9 @@
 }
 
 function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
-	global $current_user, $wpdb;
+	global $wpdb;
 
+	$current_user = wp_get_current_user();
 	if ( $user_id == 0 )
 		$user_id = $current_user->ID;
 	if ( $blog_id == 0 )
Index: wp-admin/includes/bookmark.php
===================================================================
--- wp-admin/includes/bookmark.php	(revision 15270)
+++ wp-admin/includes/bookmark.php	(working copy)
@@ -128,7 +128,7 @@
  * @return unknown
  */
 function wp_insert_link( $linkdata, $wp_error = false ) {
-	global $wpdb, $current_user;
+	global $wpdb;
 
 	$defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 );
 
@@ -166,7 +166,7 @@
 		$link_visible = 'Y';
 
 	if ( empty( $link_owner ) )
-		$link_owner = $current_user->id;
+		$link_owner = get_current_user_id();
 
 	if ( empty( $link_notes ) )
 		$link_notes = '';
Index: wp-admin/includes/post.php
===================================================================
--- wp-admin/includes/post.php	(revision 15270)
+++ wp-admin/includes/post.php	(working copy)
@@ -1170,8 +1170,6 @@
  * @return bool|int False: not locked or locked by current user. Int: user ID of user with lock.
  */
 function wp_check_post_lock( $post_id ) {
-	global $current_user;
-
 	if ( !$post = get_post( $post_id ) )
 		return false;
 
@@ -1180,7 +1178,7 @@
 
 	$time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );
 
-	if ( $lock && $lock > time() - $time_window && $last != $current_user->ID )
+	if ( $lock && $lock > time() - $time_window && $last != get_current_user_id() )
 		return $last;
 	return false;
 }
@@ -1194,10 +1192,9 @@
  * @return bool Returns false if the post doesn't exist of there is no current user
  */
 function wp_set_post_lock( $post_id ) {
-	global $current_user;
 	if ( !$post = get_post( $post_id ) )
 		return false;
-	if ( !$current_user || !$current_user->ID )
+	if ( 0 == get_current_user_id() )
 		return false;
 
 	$now = time();
@@ -1252,8 +1249,7 @@
 	if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
 		$new_autosave = _wp_post_revision_fields( $_POST, true );
 		$new_autosave['ID'] = $old_autosave->ID;
-		$current_user = wp_get_current_user();
-		$new_autosave['post_author'] = $current_user->ID;
+		$new_autosave['post_author'] = get_current_user_id();
 		return wp_update_post( $new_autosave );
 	}
 
@@ -1611,4 +1607,4 @@
 /* ]]> */
 </script>
 <?php
-}
\ No newline at end of file
+}
Index: wp-admin/includes/meta-boxes.php
===================================================================
--- wp-admin/includes/meta-boxes.php	(revision 15270)
+++ wp-admin/includes/meta-boxes.php	(working copy)
@@ -501,8 +501,8 @@
  * @param object $post
  */
 function post_author_meta_box($post) {
-	global $current_user, $user_ID;
-	$authors = get_editable_user_ids( $current_user->id, true, $post->post_type ); // TODO: ROLE SYSTEM
+	global $user_ID;
+	$authors = get_editable_user_ids( get_current_user_id(), true, $post->post_type ); // TODO: ROLE SYSTEM
 	if ( $post->post_author && !in_array($post->post_author, $authors) )
 		$authors[] = $post->post_author;
 ?>
Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 15270)
+++ wp-admin/includes/template.php	(working copy)
@@ -847,7 +847,7 @@
  * @param string $screen
  */
 function inline_edit_row( $screen ) {
-	global $current_user, $mode;
+	global $mode;
 
 	if ( is_string($screen) ) {
 		$screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen );
@@ -928,7 +928,7 @@
 <?php endif; // $bulk
 
 	if ( post_type_supports( $screen->post_type, 'author' ) ) :
-		$authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM
+		$authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM
 		$authors_dropdown = '';
 		if ( $authors && count( $authors ) > 1 ) :
 			$users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);
@@ -1269,7 +1269,7 @@
  * @param unknown_type $mode
  */
 function _post_row($a_post, $pending_comments, $mode) {
-	global $post, $current_user, $current_screen;
+	global $post, $current_screen;
 	static $rowclass;
 
 	$global_post = $post;
@@ -1277,7 +1277,7 @@
 	setup_postdata($post);
 
 	$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
-	$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
+	$post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
 	$edit_link = get_edit_post_link( $post->ID );
 	$title = _draft_or_post_title();
 	$post_type_object = get_post_type_object($post->post_type);
@@ -1795,8 +1795,6 @@
 function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
 	global $wp_roles;
 
-	$current_user = wp_get_current_user();
-
 	if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
 		$user_object = new WP_User( (int) $user_object );
 	$user_object = sanitize_user_object($user_object, 'display');
@@ -1813,7 +1811,7 @@
 	if ( current_user_can( 'list_users' ) ) {
 		// Set up the user editing link
 		// TODO: make profile/user-edit determination a separate function
-		if ($current_user->ID == $user_object->ID) {
+		if ( get_current_user_id() == $user_object->ID) {
 			$edit_link = 'profile.php';
 		} else {
 			$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
@@ -1830,9 +1828,9 @@
 			$edit = "<strong>$user_object->user_login</strong><br />";
 		}
 
-		if ( !is_multisite() && $current_user->ID != $user_object->ID && current_user_can('delete_user', $user_object->ID) )
+		if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID) )
 			$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . "</a>";
-		if ( is_multisite() && $current_user->ID != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
+		if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
 			$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=remove&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Remove') . "</a>";
 		$actions = apply_filters('user_row_actions', $actions, $user_object);
 		$action_count = count($actions);
@@ -2225,8 +2223,6 @@
  * @param unknown_type $mode
  */
 function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
-	global $current_user;
-
 	// allow plugin to replace the popup content
 	$content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) );
 
@@ -2278,7 +2274,7 @@
 	<br class="clear" />
 	</p>
 
-	<input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />
+	<input type="hidden" name="user_ID" id="user_ID" value="<?php echo get_current_user_id(); ?>" />
 	<input type="hidden" name="action" id="action" value="" />
 	<input type="hidden" name="comment_ID" id="comment_ID" value="" />
 	<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
Index: wp-admin/includes/user.php
===================================================================
--- wp-admin/includes/user.php	(revision 15270)
+++ wp-admin/includes/user.php	(working copy)
@@ -21,13 +21,13 @@
  */
 function add_user() {
 	if ( func_num_args() ) { // The hackiest hack that ever did hack
-		global $current_user, $wp_roles;
+		global $wp_roles;
 		$user_id = (int) func_get_arg( 0 );
 
 		if ( isset( $_POST['role'] ) ) {
 			$new_role = sanitize_text_field( $_POST['role'] );
 			// Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
-			if ( $user_id != $current_user->id || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {
+			if ( $user_id != get_current_user_id() || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {
 				// If the new role isn't editable by the logged-in user die with error
 				$editable_roles = get_editable_roles();
 				if ( empty( $editable_roles[$new_role] ) )
@@ -54,7 +54,7 @@
  * @return int user id of the updated user
  */
 function edit_user( $user_id = 0 ) {
-	global $current_user, $wp_roles, $wpdb;
+	global $wp_roles, $wpdb;
 	if ( $user_id != 0 ) {
 		$update = true;
 		$user->ID = (int) $user_id;
@@ -79,7 +79,7 @@
 		$potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false;
 		// Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
 		// Multisite super admins can freely edit their blog roles -- they possess all caps.
-		if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != $current_user->id || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
+		if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
 			$user->role = $new_role;
 
 		// If the new role isn't editable by the logged-in user die with error
Index: wp-admin/includes/ms.php
===================================================================
--- wp-admin/includes/ms.php	(revision 15270)
+++ wp-admin/includes/ms.php	(working copy)
@@ -178,17 +178,17 @@
 }
 
 function confirm_delete_users( $users ) {
-	global $current_user;
+	$current_user = wp_get_current_user();
 	if ( !is_array( $users ) )
 		return false;
 
-    screen_icon();
-    ?>
+	screen_icon();
+	?>
 	<h2><?php esc_html_e( 'Users' ); ?></h2>
 	<p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
 	<form action="ms-edit.php?action=dodelete" method="post">
 	<input type="hidden" name="dodelete" />
-    <?php
+	<?php
 	wp_nonce_field( 'ms-users-delete' );
 	$site_admins = get_super_admins();
 	$admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";
@@ -311,7 +311,8 @@
 add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
 
 function send_confirmation_on_profile_email() {
-	global $errors, $wpdb, $current_user;
+	global $errors, $wpdb;
+	$current_user = wp_get_current_user();
 	if ( ! is_object($errors) )
 		$errors = new WP_Error();
 
@@ -364,8 +365,7 @@
 add_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
 
 function new_user_email_admin_notice() {
-	global $current_user;
-	if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( $current_user->ID . '_new_email' ) )
+	if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( get_current_user_id() . '_new_email' ) )
 		echo "<div class='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>";
 }
 add_action( 'admin_notices', 'new_user_email_admin_notice' );
@@ -598,7 +598,6 @@
 add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );
 
 function redirect_user_to_blog() {
-	global $current_user;
 	$c = 0;
 	if ( isset( $_GET['c'] ) )
 		$c = (int) $_GET['c'];
@@ -608,7 +607,7 @@
 	}
 	$c ++;
 
-	$blog = get_active_blog_for_user( $current_user->ID );
+	$blog = get_active_blog_for_user( get_current_user_id() );
 	$dashboard_blog = get_dashboard_blog();
 	if ( is_object( $blog ) ) {
 		wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case"
@@ -619,16 +618,16 @@
 	   If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
 	   then update the primary_blog record to match the user's blog
 	 */
-	$blogs = get_blogs_of_user( $current_user->ID );
+	$blogs = get_blogs_of_user( get_current_user_id() );
 
 	if ( !empty( $blogs ) ) {
 		foreach( $blogs as $blogid => $blog ) {
-			if ( $blogid != $dashboard_blog->blog_id && get_user_meta( $current_user->ID , 'primary_blog', true ) == $dashboard_blog->blog_id ) {
-				update_user_meta( $current_user->ID, 'primary_blog', $blogid );
+			if ( $blogid != $dashboard_blog->blog_id && get_user_meta( get_current_user_id() , 'primary_blog', true ) == $dashboard_blog->blog_id ) {
+				update_user_meta( get_current_user_id(), 'primary_blog', $blogid );
 				continue;
 			}
 		}
-		$blog = get_blog_details( get_user_meta( $current_user->ID, 'primary_blog', true ) );
+		$blog = get_blog_details( get_user_meta( get_current_user_id(), 'primary_blog', true ) );
 			wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) );
 		exit;
 	}
@@ -697,12 +696,12 @@
 add_action( 'admin_notices', 'secret_salt_warning' );
 
 function admin_notice_feed() {
-	global $current_user, $current_screen;
+	global $current_screen;
 	if ( $current_screen->id != 'dashboard' )
 		return;
 
 	if ( !empty( $_GET['feed_dismiss'] ) ) {
-		update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET['feed_dismiss'], true );
+		update_user_option( get_current_user_id(), 'admin_feed_dismiss', $_GET['feed_dismiss'], true );
 		return;
 	}
 
@@ -728,7 +727,7 @@
 add_action( 'admin_notices', 'admin_notice_feed' );
 
 function site_admin_notice() {
-	global $current_user, $wp_db_version;
+	global $wp_db_version;
 	if ( !is_super_admin() )
 		return false;
 	if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version )
@@ -760,7 +759,6 @@
 add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 );
 
 function choose_primary_blog() {
-	global $current_user;
 	?>
 	<table class="form-table">
 	<tr>
@@ -768,8 +766,8 @@
 		<th scope="row"><?php _e( 'Primary Site' ); ?></th>
 		<td>
 		<?php
-		$all_blogs = get_blogs_of_user( $current_user->ID );
-		$primary_blog = get_user_meta( $current_user->ID, 'primary_blog', true );
+		$all_blogs = get_blogs_of_user( get_current_user_id() );
+		$primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
 		if ( count( $all_blogs ) > 1 ) {
 			$found = false;
 			?>
@@ -783,13 +781,13 @@
 			<?php
 			if ( !$found ) {
 				$blog = array_shift( $all_blogs );
-				update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );
+				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
 			}
 		} elseif ( count( $all_blogs ) == 1 ) {
 			$blog = array_shift( $all_blogs );
 			echo $blog->domain;
 			if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
-				update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );
+				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
 		} else {
 			echo "N/A";
 		}
Index: wp-admin/includes/class-wp-importer.php
===================================================================
--- wp-admin/includes/class-wp-importer.php	(revision 15270)
+++ wp-admin/includes/class-wp-importer.php	(working copy)
@@ -215,7 +215,7 @@
 	 * @return bool
 	 */
 	function is_user_over_quota() {
-		global $current_user, $current_blog;
+		global $current_blog;
 
 		if ( function_exists( 'upload_is_user_over_quota' ) ) {
 			if ( upload_is_user_over_quota( 1 ) ) {
Index: wp-admin/edit-attachment-rows.php
===================================================================
--- wp-admin/edit-attachment-rows.php	(revision 15270)
+++ wp-admin/edit-attachment-rows.php	(working copy)
@@ -39,8 +39,8 @@
 	continue;
 
 $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
-global $current_user;
-$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
+
+$post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
 $att_title = _draft_or_post_title();
 ?>
 	<tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
