Changeset 15315
- Timestamp:
- 06/24/2010 03:01:29 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-attachment-rows.php
r14673 r15315 40 40 41 41 $alt = ( 'alternate' == $alt ) ? '' : 'alternate'; 42 global $current_user; 43 $post_owner = ( $current_user->ID== $post->post_author ? 'self' : 'other' );42 43 $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' ); 44 44 $att_title = _draft_or_post_title(); 45 45 ?> -
trunk/wp-admin/includes/bookmark.php
r13106 r15315 129 129 */ 130 130 function wp_insert_link( $linkdata, $wp_error = false ) { 131 global $wpdb , $current_user;131 global $wpdb; 132 132 133 133 $defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 ); … … 167 167 168 168 if ( empty( $link_owner ) ) 169 $link_owner = $current_user->id;169 $link_owner = get_current_user_id(); 170 170 171 171 if ( empty( $link_notes ) ) -
trunk/wp-admin/includes/class-wp-importer.php
r15297 r15315 217 217 */ 218 218 function is_user_over_quota() { 219 global $current_ user, $current_blog;219 global $current_blog; 220 220 221 221 if ( function_exists( 'upload_is_user_over_quota' ) ) { -
trunk/wp-admin/includes/meta-boxes.php
r15190 r15315 502 502 */ 503 503 function post_author_meta_box($post) { 504 global $ current_user, $user_ID;505 $authors = get_editable_user_ids( $current_user->id, true, $post->post_type ); // TODO: ROLE SYSTEM504 global $user_ID; 505 $authors = get_editable_user_ids( get_current_user_id(), true, $post->post_type ); // TODO: ROLE SYSTEM 506 506 if ( $post->post_author && !in_array($post->post_author, $authors) ) 507 507 $authors[] = $post->post_author; -
trunk/wp-admin/includes/ms.php
r15228 r15315 179 179 180 180 function confirm_delete_users( $users ) { 181 global $current_user;181 $current_user = wp_get_current_user(); 182 182 if ( !is_array( $users ) ) 183 183 return false; 184 184 185 186 185 screen_icon(); 186 ?> 187 187 <h2><?php esc_html_e( 'Users' ); ?></h2> 188 188 <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p> 189 189 <form action="ms-edit.php?action=dodelete" method="post"> 190 190 <input type="hidden" name="dodelete" /> 191 191 <?php 192 192 wp_nonce_field( 'ms-users-delete' ); 193 193 $site_admins = get_super_admins(); … … 312 312 313 313 function send_confirmation_on_profile_email() { 314 global $errors, $wpdb, $current_user; 314 global $errors, $wpdb; 315 $current_user = wp_get_current_user(); 315 316 if ( ! is_object($errors) ) 316 317 $errors = new WP_Error(); … … 365 366 366 367 function new_user_email_admin_notice() { 367 global $current_user; 368 if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( $current_user->ID . '_new_email' ) ) 368 if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( get_current_user_id() . '_new_email' ) ) 369 369 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>"; 370 370 } … … 599 599 600 600 function redirect_user_to_blog() { 601 global $current_user;602 601 $c = 0; 603 602 if ( isset( $_GET['c'] ) ) … … 609 608 $c ++; 610 609 611 $blog = get_active_blog_for_user( $current_user->ID);610 $blog = get_active_blog_for_user( get_current_user_id() ); 612 611 $dashboard_blog = get_dashboard_blog(); 613 612 if ( is_object( $blog ) ) { … … 620 619 then update the primary_blog record to match the user's blog 621 620 */ 622 $blogs = get_blogs_of_user( $current_user->ID);621 $blogs = get_blogs_of_user( get_current_user_id() ); 623 622 624 623 if ( !empty( $blogs ) ) { 625 624 foreach( $blogs as $blogid => $blog ) { 626 if ( $blogid != $dashboard_blog->blog_id && get_user_meta( $current_user->ID, 'primary_blog', true ) == $dashboard_blog->blog_id ) {627 update_user_meta( $current_user->ID, 'primary_blog', $blogid );625 if ( $blogid != $dashboard_blog->blog_id && get_user_meta( get_current_user_id() , 'primary_blog', true ) == $dashboard_blog->blog_id ) { 626 update_user_meta( get_current_user_id(), 'primary_blog', $blogid ); 628 627 continue; 629 628 } 630 629 } 631 $blog = get_blog_details( get_user_meta( $current_user->ID, 'primary_blog', true ) );630 $blog = get_blog_details( get_user_meta( get_current_user_id(), 'primary_blog', true ) ); 632 631 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); 633 632 exit; … … 698 697 699 698 function admin_notice_feed() { 700 global $current_ user, $current_screen;699 global $current_screen; 701 700 if ( $current_screen->id != 'dashboard' ) 702 701 return; 703 702 704 703 if ( !empty( $_GET['feed_dismiss'] ) ) { 705 update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET['feed_dismiss'], true );704 update_user_option( get_current_user_id(), 'admin_feed_dismiss', $_GET['feed_dismiss'], true ); 706 705 return; 707 706 } … … 729 728 730 729 function site_admin_notice() { 731 global $ current_user, $wp_db_version;730 global $wp_db_version; 732 731 if ( !is_super_admin() ) 733 732 return false; … … 761 760 762 761 function choose_primary_blog() { 763 global $current_user;764 762 ?> 765 763 <table class="form-table"> … … 769 767 <td> 770 768 <?php 771 $all_blogs = get_blogs_of_user( $current_user->ID);772 $primary_blog = get_user_meta( $current_user->ID, 'primary_blog', true );769 $all_blogs = get_blogs_of_user( get_current_user_id() ); 770 $primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true ); 773 771 if ( count( $all_blogs ) > 1 ) { 774 772 $found = false; … … 784 782 if ( !$found ) { 785 783 $blog = array_shift( $all_blogs ); 786 update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );784 update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id ); 787 785 } 788 786 } elseif ( count( $all_blogs ) == 1 ) { … … 790 788 echo $blog->domain; 791 789 if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list. 792 update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );790 update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id ); 793 791 } else { 794 792 echo "N/A"; -
trunk/wp-admin/includes/post.php
r15032 r15315 1171 1171 */ 1172 1172 function wp_check_post_lock( $post_id ) { 1173 global $current_user;1174 1175 1173 if ( !$post = get_post( $post_id ) ) 1176 1174 return false; … … 1181 1179 $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 ); 1182 1180 1183 if ( $lock && $lock > time() - $time_window && $last != $current_user->ID)1181 if ( $lock && $lock > time() - $time_window && $last != get_current_user_id() ) 1184 1182 return $last; 1185 1183 return false; … … 1195 1193 */ 1196 1194 function wp_set_post_lock( $post_id ) { 1197 global $current_user;1198 1195 if ( !$post = get_post( $post_id ) ) 1199 1196 return false; 1200 if ( !$current_user || !$current_user->ID)1197 if ( 0 == get_current_user_id() ) 1201 1198 return false; 1202 1199 … … 1253 1250 $new_autosave = _wp_post_revision_fields( $_POST, true ); 1254 1251 $new_autosave['ID'] = $old_autosave->ID; 1255 $current_user = wp_get_current_user(); 1256 $new_autosave['post_author'] = $current_user->ID; 1252 $new_autosave['post_author'] = get_current_user_id(); 1257 1253 return wp_update_post( $new_autosave ); 1258 1254 } -
trunk/wp-admin/includes/template.php
r15280 r15315 848 848 */ 849 849 function inline_edit_row( $screen ) { 850 global $ current_user, $mode;850 global $mode; 851 851 852 852 if ( is_string($screen) ) { … … 929 929 930 930 if ( post_type_supports( $screen->post_type, 'author' ) ) : 931 $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM931 $authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM 932 932 $authors_dropdown = ''; 933 933 if ( $authors && count( $authors ) > 1 ) : … … 1269 1269 */ 1270 1270 function _post_row($a_post, $pending_comments, $mode) { 1271 global $post, $current_ user, $current_screen;1271 global $post, $current_screen; 1272 1272 static $rowclass; 1273 1273 … … 1277 1277 1278 1278 $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; 1279 $post_owner = ( $current_user->ID== $post->post_author ? 'self' : 'other' );1279 $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' ); 1280 1280 $edit_link = get_edit_post_link( $post->ID ); 1281 1281 $title = _draft_or_post_title(); … … 1795 1795 global $wp_roles; 1796 1796 1797 $current_user = wp_get_current_user();1798 1799 1797 if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) ) 1800 1798 $user_object = new WP_User( (int) $user_object ); … … 1813 1811 // Set up the user editing link 1814 1812 // TODO: make profile/user-edit determination a separate function 1815 if ( $current_user->ID== $user_object->ID) {1813 if ( get_current_user_id() == $user_object->ID) { 1816 1814 $edit_link = 'profile.php'; 1817 1815 } else { … … 1830 1828 } 1831 1829 1832 if ( !is_multisite() && $current_user->ID!= $user_object->ID && current_user_can('delete_user', $user_object->ID) )1830 if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID) ) 1833 1831 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . '</a>'; 1834 if ( is_multisite() && $current_user->ID!= $user_object->ID && current_user_can('remove_user', $user_object->ID) )1832 if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID) ) 1835 1833 $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=remove&user=$user_object->ID", 'bulk-users') . "'>" . __('Remove') . '</a>'; 1836 1834 $actions = apply_filters('user_row_actions', $actions, $user_object); … … 2225 2223 */ 2226 2224 function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) { 2227 global $current_user;2228 2229 2225 // allow plugin to replace the popup content 2230 2226 $content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) ); … … 2278 2274 </p> 2279 2275 2280 <input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />2276 <input type="hidden" name="user_ID" id="user_ID" value="<?php echo get_current_user_id(); ?>" /> 2281 2277 <input type="hidden" name="action" id="action" value="" /> 2282 2278 <input type="hidden" name="comment_ID" id="comment_ID" value="" /> -
trunk/wp-admin/includes/user.php
r14608 r15315 22 22 function add_user() { 23 23 if ( func_num_args() ) { // The hackiest hack that ever did hack 24 global $ current_user, $wp_roles;24 global $wp_roles; 25 25 $user_id = (int) func_get_arg( 0 ); 26 26 … … 28 28 $new_role = sanitize_text_field( $_POST['role'] ); 29 29 // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. 30 if ( $user_id != $current_user->id|| $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {30 if ( $user_id != get_current_user_id() || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) { 31 31 // If the new role isn't editable by the logged-in user die with error 32 32 $editable_roles = get_editable_roles(); … … 55 55 */ 56 56 function edit_user( $user_id = 0 ) { 57 global $ current_user, $wp_roles, $wpdb;57 global $wp_roles, $wpdb; 58 58 if ( $user_id != 0 ) { 59 59 $update = true; … … 80 80 // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. 81 81 // Multisite super admins can freely edit their blog roles -- they possess all caps. 82 if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != $current_user->id|| ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )82 if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) ) 83 83 $user->role = $new_role; 84 84 -
trunk/wp-includes/ms-blogs.php
r15168 r15315 372 372 373 373 function switch_to_blog( $new_blog, $validate = false ) { 374 global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $ current_user, $wp_object_cache;374 global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; 375 375 376 376 if ( empty($new_blog) ) … … 407 407 $wpdb->suppress_errors( false ); 408 408 } 409 409 410 $current_user = wp_get_current_user(); 410 411 if ( is_object( $current_user ) ) 411 412 $current_user->for_blog( $blog_id ); … … 431 432 432 433 function restore_current_blog() { 433 global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $ current_user, $wp_object_cache;434 global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; 434 435 435 436 if ( !$switched ) … … 461 462 } 462 463 464 $current_user = wp_get_current_user(); 463 465 if ( is_object( $current_user ) ) 464 466 $current_user->for_blog( $blog_id ); -
trunk/wp-includes/ms-functions.php
r15290 r15315 373 373 374 374 function is_blog_user( $blog_id = 0 ) { 375 global $current_user, $wpdb; 376 375 global $wpdb; 376 377 $current_user = wp_get_current_user(); 377 378 if ( !$blog_id ) 378 379 $blog_id = $wpdb->blogid; … … 1320 1321 function is_user_spammy( $username = 0 ) { 1321 1322 if ( $username == 0 ) { 1322 global $current_user; 1323 $user_id = $current_user->ID; 1323 $user_id = get_current_user_id(); 1324 1324 } else { 1325 1325 $user_id = get_user_id_from_string( $username ); … … 1361 1361 1362 1362 function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) { 1363 global $current_user, $wpdb; 1364 1363 global $wpdb; 1364 1365 $current_user = wp_get_current_user(); 1365 1366 if ( $user_id == 0 ) 1366 1367 $user_id = $current_user->ID; -
trunk/wp-signup.php
r15235 r15315 154 154 155 155 function signup_another_blog($blogname = '', $blog_title = '', $errors = '') { 156 global $current_user, $current_site; 156 global $current_site; 157 $current_user = wp_get_current_user(); 157 158 158 159 if ( ! is_wp_error($errors) ) { … … 198 199 199 200 function validate_another_blog_signup() { 200 global $wpdb, $ current_user, $blogname, $blog_title, $errors, $domain, $path;201 global $wpdb, $blogname, $blog_title, $errors, $domain, $path; 201 202 $current_user = wp_get_current_user(); 202 203 if ( !is_user_logged_in() )
Note: See TracChangeset
for help on using the changeset viewer.