<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[15315] trunk: Use get_current_user() and get_current_user_id()
instead of global .</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15315">15315</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-06-24 15:01:29 +0000 (Thu, 24 Jun 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use get_current_user() and get_current_user_id() instead of global . Props filofo. see <a href="http://trac.wordpress.org/ticket/13934">#13934</a> for trunk</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmineditattachmentrowsphp">trunk/wp-admin/edit-attachment-rows.php</a></li>
<li><a href="#trunkwpadminincludesbookmarkphp">trunk/wp-admin/includes/bookmark.php</a></li>
<li><a href="#trunkwpadminincludesclasswpimporterphp">trunk/wp-admin/includes/class-wp-importer.php</a></li>
<li><a href="#trunkwpadminincludesmetaboxesphp">trunk/wp-admin/includes/meta-boxes.php</a></li>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminincludesuserphp">trunk/wp-admin/includes/user.php</a></li>
<li><a href="#trunkwpincludesmsblogsphp">trunk/wp-includes/ms-blogs.php</a></li>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
<li><a href="#trunkwpsignupphp">trunk/wp-signup.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmineditattachmentrowsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-attachment-rows.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-attachment-rows.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-admin/edit-attachment-rows.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -39,8 +39,8 @@
</span><span class="cx">         continue;
</span><span class="cx">
</span><span class="cx"> $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
</span><del>-global $current_user;
-$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
</del><ins>+
+$post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
</ins><span class="cx"> $att_title = _draft_or_post_title();
</span><span class="cx"> ?>
</span><span class="cx">         <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
</span></span></pre></div>
<a id="trunkwpadminincludesbookmarkphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/bookmark.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/bookmark.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-admin/includes/bookmark.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx"> * @return unknown
</span><span class="cx"> */
</span><span class="cx"> function wp_insert_link( $linkdata, $wp_error = false ) {
</span><del>-        global $wpdb, $current_user;
</del><ins>+        global $wpdb;
</ins><span class="cx">
</span><span class="cx">         $defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 );
</span><span class="cx">
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx">                 $link_visible = 'Y';
</span><span class="cx">
</span><span class="cx">         if ( empty( $link_owner ) )
</span><del>-                $link_owner = $current_user->id;
</del><ins>+                $link_owner = get_current_user_id();
</ins><span class="cx">
</span><span class="cx">         if ( empty( $link_notes ) )
</span><span class="cx">                 $link_notes = '';
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpimporterphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-importer.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-importer.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-admin/includes/class-wp-importer.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -216,7 +216,7 @@
</span><span class="cx">          * @return bool
</span><span class="cx">          */
</span><span class="cx">         function is_user_over_quota() {
</span><del>-                global $current_user, $current_blog;
</del><ins>+                global $current_blog;
</ins><span class="cx">
</span><span class="cx">                 if ( function_exists( 'upload_is_user_over_quota' ) ) {
</span><span class="cx">                         if ( upload_is_user_over_quota( 1 ) ) {
</span></span></pre></div>
<a id="trunkwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/meta-boxes.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/meta-boxes.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-admin/includes/meta-boxes.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -501,8 +501,8 @@
</span><span class="cx"> * @param object $post
</span><span class="cx"> */
</span><span class="cx"> function post_author_meta_box($post) {
</span><del>-        global $current_user, $user_ID;
-        $authors = get_editable_user_ids( $current_user->id, true, $post->post_type ); // TODO: ROLE SYSTEM
</del><ins>+        global $user_ID;
+        $authors = get_editable_user_ids( get_current_user_id(), true, $post->post_type ); // TODO: ROLE SYSTEM
</ins><span class="cx">         if ( $post->post_author && !in_array($post->post_author, $authors) )
</span><span class="cx">                 $authors[] = $post->post_author;
</span><span class="cx"> ?>
</span></span></pre></div>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-admin/includes/ms.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -178,17 +178,17 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function confirm_delete_users( $users ) {
</span><del>-        global $current_user;
</del><ins>+        $current_user = wp_get_current_user();
</ins><span class="cx">         if ( !is_array( $users ) )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><del>- screen_icon();
- ?>
</del><ins>+        screen_icon();
+        ?>
</ins><span class="cx">         <h2><?php esc_html_e( 'Users' ); ?></h2>
</span><span class="cx">         <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
</span><span class="cx">         <form action="ms-edit.php?action=dodelete" method="post">
</span><span class="cx">         <input type="hidden" name="dodelete" />
</span><del>- <?php
</del><ins>+        <?php
</ins><span class="cx">         wp_nonce_field( 'ms-users-delete' );
</span><span class="cx">         $site_admins = get_super_admins();
</span><span class="cx">         $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";
</span><span class="lines">@@ -311,7 +311,8 @@
</span><span class="cx"> add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
</span><span class="cx">
</span><span class="cx"> function send_confirmation_on_profile_email() {
</span><del>-        global $errors, $wpdb, $current_user;
</del><ins>+        global $errors, $wpdb;
+        $current_user = wp_get_current_user();
</ins><span class="cx">         if ( ! is_object($errors) )
</span><span class="cx">                 $errors = new WP_Error();
</span><span class="cx">
</span><span class="lines">@@ -364,8 +365,7 @@
</span><span class="cx"> add_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
</span><span class="cx">
</span><span class="cx"> function new_user_email_admin_notice() {
</span><del>-        global $current_user;
-        if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( $current_user->ID . '_new_email' ) )
</del><ins>+        if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( get_current_user_id() . '_new_email' ) )
</ins><span class="cx">                 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>";
</span><span class="cx"> }
</span><span class="cx"> add_action( 'admin_notices', 'new_user_email_admin_notice' );
</span><span class="lines">@@ -598,7 +598,6 @@
</span><span class="cx"> add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );
</span><span class="cx">
</span><span class="cx"> function redirect_user_to_blog() {
</span><del>-        global $current_user;
</del><span class="cx">         $c = 0;
</span><span class="cx">         if ( isset( $_GET['c'] ) )
</span><span class="cx">                 $c = (int) $_GET['c'];
</span><span class="lines">@@ -608,7 +607,7 @@
</span><span class="cx">         }
</span><span class="cx">         $c ++;
</span><span class="cx">
</span><del>-        $blog = get_active_blog_for_user( $current_user->ID );
</del><ins>+        $blog = get_active_blog_for_user( get_current_user_id() );
</ins><span class="cx">         $dashboard_blog = get_dashboard_blog();
</span><span class="cx">         if ( is_object( $blog ) ) {
</span><span class="cx">                 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case"
</span><span class="lines">@@ -619,16 +618,16 @@
</span><span class="cx">          If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
</span><span class="cx">          then update the primary_blog record to match the user's blog
</span><span class="cx">          */
</span><del>-        $blogs = get_blogs_of_user( $current_user->ID );
</del><ins>+        $blogs = get_blogs_of_user( get_current_user_id() );
</ins><span class="cx">
</span><span class="cx">         if ( !empty( $blogs ) ) {
</span><span class="cx">                 foreach( $blogs as $blogid => $blog ) {
</span><del>-                        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 );
</del><ins>+                        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 );
</ins><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                $blog = get_blog_details( get_user_meta( $current_user->ID, 'primary_blog', true ) );
</del><ins>+                $blog = get_blog_details( get_user_meta( get_current_user_id(), 'primary_blog', true ) );
</ins><span class="cx">                         wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) );
</span><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="lines">@@ -697,12 +696,12 @@
</span><span class="cx"> add_action( 'admin_notices', 'secret_salt_warning' );
</span><span class="cx">
</span><span class="cx"> function admin_notice_feed() {
</span><del>-        global $current_user, $current_screen;
</del><ins>+        global $current_screen;
</ins><span class="cx">         if ( $current_screen->id != 'dashboard' )
</span><span class="cx">                 return;
</span><span class="cx">
</span><span class="cx">         if ( !empty( $_GET['feed_dismiss'] ) ) {
</span><del>-                update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET['feed_dismiss'], true );
</del><ins>+                update_user_option( get_current_user_id(), 'admin_feed_dismiss', $_GET['feed_dismiss'], true );
</ins><span class="cx">                 return;
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -728,7 +727,7 @@
</span><span class="cx"> add_action( 'admin_notices', 'admin_notice_feed' );
</span><span class="cx">
</span><span class="cx"> function site_admin_notice() {
</span><del>-        global $current_user, $wp_db_version;
</del><ins>+        global $wp_db_version;
</ins><span class="cx">         if ( !is_super_admin() )
</span><span class="cx">                 return false;
</span><span class="cx">         if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version )
</span><span class="lines">@@ -760,7 +759,6 @@
</span><span class="cx"> add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 );
</span><span class="cx">
</span><span class="cx"> function choose_primary_blog() {
</span><del>-        global $current_user;
</del><span class="cx">         ?>
</span><span class="cx">         <table class="form-table">
</span><span class="cx">         <tr>
</span><span class="lines">@@ -768,8 +766,8 @@
</span><span class="cx">                 <th scope="row"><?php _e( 'Primary Site' ); ?></th>
</span><span class="cx">                 <td>
</span><span class="cx">                 <?php
</span><del>-                $all_blogs = get_blogs_of_user( $current_user->ID );
-                $primary_blog = get_user_meta( $current_user->ID, 'primary_blog', true );
</del><ins>+                $all_blogs = get_blogs_of_user( get_current_user_id() );
+                $primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
</ins><span class="cx">                 if ( count( $all_blogs ) > 1 ) {
</span><span class="cx">                         $found = false;
</span><span class="cx">                         ?>
</span><span class="lines">@@ -783,13 +781,13 @@
</span><span class="cx">                         <?php
</span><span class="cx">                         if ( !$found ) {
</span><span class="cx">                                 $blog = array_shift( $all_blogs );
</span><del>-                                update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );
</del><ins>+                                update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
</ins><span class="cx">                         }
</span><span class="cx">                 } elseif ( count( $all_blogs ) == 1 ) {
</span><span class="cx">                         $blog = array_shift( $all_blogs );
</span><span class="cx">                         echo $blog->domain;
</span><span class="cx">                         if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
</span><del>-                                update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );
</del><ins>+                                update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
</ins><span class="cx">                 } else {
</span><span class="cx">                         echo "N/A";
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-admin/includes/post.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -1170,8 +1170,6 @@
</span><span class="cx"> * @return bool|int False: not locked or locked by current user. Int: user ID of user with lock.
</span><span class="cx"> */
</span><span class="cx"> function wp_check_post_lock( $post_id ) {
</span><del>-        global $current_user;
-
</del><span class="cx">         if ( !$post = get_post( $post_id ) )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><span class="lines">@@ -1180,7 +1178,7 @@
</span><span class="cx">
</span><span class="cx">         $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );
</span><span class="cx">
</span><del>-        if ( $lock && $lock > time() - $time_window && $last != $current_user->ID )
</del><ins>+        if ( $lock && $lock > time() - $time_window && $last != get_current_user_id() )
</ins><span class="cx">                 return $last;
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="lines">@@ -1194,10 +1192,9 @@
</span><span class="cx"> * @return bool Returns false if the post doesn't exist of there is no current user
</span><span class="cx"> */
</span><span class="cx"> function wp_set_post_lock( $post_id ) {
</span><del>-        global $current_user;
</del><span class="cx">         if ( !$post = get_post( $post_id ) )
</span><span class="cx">                 return false;
</span><del>-        if ( !$current_user || !$current_user->ID )
</del><ins>+        if ( 0 == get_current_user_id() )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         $now = time();
</span><span class="lines">@@ -1252,8 +1249,7 @@
</span><span class="cx">         if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
</span><span class="cx">                 $new_autosave = _wp_post_revision_fields( $_POST, true );
</span><span class="cx">                 $new_autosave['ID'] = $old_autosave->ID;
</span><del>-                $current_user = wp_get_current_user();
-                $new_autosave['post_author'] = $current_user->ID;
</del><ins>+                $new_autosave['post_author'] = get_current_user_id();
</ins><span class="cx">                 return wp_update_post( $new_autosave );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -1611,4 +1607,4 @@
</span><span class="cx"> /* ]]> */
</span><span class="cx"> </script>
</span><span class="cx"> <?php
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-admin/includes/template.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -847,7 +847,7 @@
</span><span class="cx"> * @param string $screen
</span><span class="cx"> */
</span><span class="cx"> function inline_edit_row( $screen ) {
</span><del>-        global $current_user, $mode;
</del><ins>+        global $mode;
</ins><span class="cx">
</span><span class="cx">         if ( is_string($screen) ) {
</span><span class="cx">                 $screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen );
</span><span class="lines">@@ -928,7 +928,7 @@
</span><span class="cx"> <?php endif; // $bulk
</span><span class="cx">
</span><span class="cx">         if ( post_type_supports( $screen->post_type, 'author' ) ) :
</span><del>-                $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM
</del><ins>+                $authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM
</ins><span class="cx">                 $authors_dropdown = '';
</span><span class="cx">                 if ( $authors && count( $authors ) > 1 ) :
</span><span class="cx">                         $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);
</span><span class="lines">@@ -1268,7 +1268,7 @@
</span><span class="cx"> * @param unknown_type $mode
</span><span class="cx"> */
</span><span class="cx"> function _post_row($a_post, $pending_comments, $mode) {
</span><del>-        global $post, $current_user, $current_screen;
</del><ins>+        global $post, $current_screen;
</ins><span class="cx">         static $rowclass;
</span><span class="cx">
</span><span class="cx">         $global_post = $post;
</span><span class="lines">@@ -1276,7 +1276,7 @@
</span><span class="cx">         setup_postdata($post);
</span><span class="cx">
</span><span class="cx">         $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
</span><del>-        $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
</del><ins>+        $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
</ins><span class="cx">         $edit_link = get_edit_post_link( $post->ID );
</span><span class="cx">         $title = _draft_or_post_title();
</span><span class="cx">         $post_type_object = get_post_type_object($post->post_type);
</span><span class="lines">@@ -1794,8 +1794,6 @@
</span><span class="cx"> function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
</span><span class="cx">         global $wp_roles;
</span><span class="cx">
</span><del>-        $current_user = wp_get_current_user();
-
</del><span class="cx">         if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
</span><span class="cx">                 $user_object = new WP_User( (int) $user_object );
</span><span class="cx">         $user_object = sanitize_user_object($user_object, 'display');
</span><span class="lines">@@ -1812,7 +1810,7 @@
</span><span class="cx">         if ( current_user_can( 'list_users' ) ) {
</span><span class="cx">                 // Set up the user editing link
</span><span class="cx">                 // TODO: make profile/user-edit determination a separate function
</span><del>-                if ($current_user->ID == $user_object->ID) {
</del><ins>+                if ( get_current_user_id() == $user_object->ID) {
</ins><span class="cx">                         $edit_link = 'profile.php';
</span><span class="cx">                 } else {
</span><span class="cx">                         $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" ) );
</span><span class="lines">@@ -1829,9 +1827,9 @@
</span><span class="cx">                         $edit = "<strong>$user_object->user_login</strong><br />";
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( !is_multisite() && $current_user->ID != $user_object->ID && current_user_can('delete_user', $user_object->ID) )
</del><ins>+                if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID) )
</ins><span class="cx">                         $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . '</a>';
</span><del>-                if ( is_multisite() && $current_user->ID != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
</del><ins>+                if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
</ins><span class="cx">                         $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=remove&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Remove') . '</a>';
</span><span class="cx">                 $actions = apply_filters('user_row_actions', $actions, $user_object);
</span><span class="cx">                 $action_count = count($actions);
</span><span class="lines">@@ -2224,8 +2222,6 @@
</span><span class="cx"> * @param unknown_type $mode
</span><span class="cx"> */
</span><span class="cx"> function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
</span><del>-        global $current_user;
-
</del><span class="cx">         // allow plugin to replace the popup content
</span><span class="cx">         $content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) );
</span><span class="cx">
</span><span class="lines">@@ -2277,7 +2273,7 @@
</span><span class="cx">         <br class="clear" />
</span><span class="cx">         </p>
</span><span class="cx">
</span><del>-        <input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />
</del><ins>+        <input type="hidden" name="user_ID" id="user_ID" value="<?php echo get_current_user_id(); ?>" />
</ins><span class="cx">         <input type="hidden" name="action" id="action" value="" />
</span><span class="cx">         <input type="hidden" name="comment_ID" id="comment_ID" value="" />
</span><span class="cx">         <input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
</span></span></pre></div>
<a id="trunkwpadminincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/user.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/user.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-admin/includes/user.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -21,13 +21,13 @@
</span><span class="cx"> */
</span><span class="cx"> function add_user() {
</span><span class="cx">         if ( func_num_args() ) { // The hackiest hack that ever did hack
</span><del>-                global $current_user, $wp_roles;
</del><ins>+                global $wp_roles;
</ins><span class="cx">                 $user_id = (int) func_get_arg( 0 );
</span><span class="cx">
</span><span class="cx">                 if ( isset( $_POST['role'] ) ) {
</span><span class="cx">                         $new_role = sanitize_text_field( $_POST['role'] );
</span><span class="cx">                         // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
</span><del>-                        if ( $user_id != $current_user->id || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {
</del><ins>+                        if ( $user_id != get_current_user_id() || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {
</ins><span class="cx">                                 // If the new role isn't editable by the logged-in user die with error
</span><span class="cx">                                 $editable_roles = get_editable_roles();
</span><span class="cx">                                 if ( empty( $editable_roles[$new_role] ) )
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> * @return int user id of the updated user
</span><span class="cx"> */
</span><span class="cx"> function edit_user( $user_id = 0 ) {
</span><del>-        global $current_user, $wp_roles, $wpdb;
</del><ins>+        global $wp_roles, $wpdb;
</ins><span class="cx">         if ( $user_id != 0 ) {
</span><span class="cx">                 $update = true;
</span><span class="cx">                 $user->ID = (int) $user_id;
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx">                 $potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false;
</span><span class="cx">                 // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
</span><span class="cx">                 // Multisite super admins can freely edit their blog roles -- they possess all caps.
</span><del>-                if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != $current_user->id || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
</del><ins>+                if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
</ins><span class="cx">                         $user->role = $new_role;
</span><span class="cx">
</span><span class="cx">                 // If the new role isn't editable by the logged-in user die with error
</span></span></pre></div>
<a id="trunkwpincludesmsblogsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-blogs.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-blogs.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-includes/ms-blogs.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -371,7 +371,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function switch_to_blog( $new_blog, $validate = false ) {
</span><del>-        global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache;
</del><ins>+        global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
</ins><span class="cx">
</span><span class="cx">         if ( empty($new_blog) )
</span><span class="cx">                 $new_blog = $blog_id;
</span><span class="lines">@@ -406,7 +406,8 @@
</span><span class="cx">                         $wp_roles->__construct();
</span><span class="cx">                 $wpdb->suppress_errors( false );
</span><span class="cx">         }
</span><del>-
</del><ins>+
+        $current_user = wp_get_current_user();
</ins><span class="cx">         if ( is_object( $current_user ) )
</span><span class="cx">                 $current_user->for_blog( $blog_id );
</span><span class="cx">
</span><span class="lines">@@ -430,7 +431,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function restore_current_blog() {
</span><del>-        global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache;
</del><ins>+        global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
</ins><span class="cx">
</span><span class="cx">         if ( !$switched )
</span><span class="cx">                 return false;
</span><span class="lines">@@ -460,6 +461,7 @@
</span><span class="cx">                 $wpdb->suppress_errors( false );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        $current_user = wp_get_current_user();
</ins><span class="cx">         if ( is_object( $current_user ) )
</span><span class="cx">                 $current_user->for_blog( $blog_id );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-includes/ms-functions.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -372,8 +372,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function is_blog_user( $blog_id = 0 ) {
</span><del>-        global $current_user, $wpdb;
-
</del><ins>+        global $wpdb;
+
+        $current_user = wp_get_current_user();
</ins><span class="cx">         if ( !$blog_id )
</span><span class="cx">                 $blog_id = $wpdb->blogid;
</span><span class="cx">
</span><span class="lines">@@ -1319,8 +1320,7 @@
</span><span class="cx">
</span><span class="cx"> function is_user_spammy( $username = 0 ) {
</span><span class="cx">         if ( $username == 0 ) {
</span><del>-                global $current_user;
-                $user_id = $current_user->ID;
</del><ins>+                $user_id = get_current_user_id();
</ins><span class="cx">         } else {
</span><span class="cx">                 $user_id = get_user_id_from_string( $username );
</span><span class="cx">         }
</span><span class="lines">@@ -1360,8 +1360,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
</span><del>-        global $current_user, $wpdb;
</del><ins>+        global $wpdb;
</ins><span class="cx">
</span><ins>+        $current_user = wp_get_current_user();
</ins><span class="cx">         if ( $user_id == 0 )
</span><span class="cx">                 $user_id = $current_user->ID;
</span><span class="cx">         if ( $blog_id == 0 )
</span></span></pre></div>
<a id="trunkwpsignupphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-signup.php (15314 => 15315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-signup.php        2010-06-24 14:53:49 UTC (rev 15314)
+++ trunk/wp-signup.php        2010-06-24 15:01:29 UTC (rev 15315)
</span><span class="lines">@@ -153,7 +153,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function signup_another_blog($blogname = '', $blog_title = '', $errors = '') {
</span><del>-        global $current_user, $current_site;
</del><ins>+        global $current_site;
+        $current_user = wp_get_current_user();
</ins><span class="cx">
</span><span class="cx">         if ( ! is_wp_error($errors) ) {
</span><span class="cx">                 $errors = new WP_Error();
</span><span class="lines">@@ -197,7 +198,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function validate_another_blog_signup() {
</span><del>-        global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path;
</del><ins>+        global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
</ins><span class="cx">         $current_user = wp_get_current_user();
</span><span class="cx">         if ( !is_user_logged_in() )
</span><span class="cx">                 die();
</span></span></pre>
</div>
</div>
</body>
</html>