Make WordPress Core


Ignore:
Timestamp:
06/24/2010 03:01:29 PM (14 years ago)
Author:
ryan
Message:

Use get_current_user() and get_current_user_id() instead of global . Props filofo. see #13934 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r15280 r15315  
    848848 */
    849849function inline_edit_row( $screen ) {
    850     global $current_user, $mode;
     850    global $mode;
    851851
    852852    if ( is_string($screen) ) {
     
    929929
    930930    if ( post_type_supports( $screen->post_type, 'author' ) ) :
    931         $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM
     931        $authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM
    932932        $authors_dropdown = '';
    933933        if ( $authors && count( $authors ) > 1 ) :
     
    12691269 */
    12701270function _post_row($a_post, $pending_comments, $mode) {
    1271     global $post, $current_user, $current_screen;
     1271    global $post, $current_screen;
    12721272    static $rowclass;
    12731273
     
    12771277
    12781278    $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' );
    12801280    $edit_link = get_edit_post_link( $post->ID );
    12811281    $title = _draft_or_post_title();
     
    17951795    global $wp_roles;
    17961796
    1797     $current_user = wp_get_current_user();
    1798 
    17991797    if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
    18001798        $user_object = new WP_User( (int) $user_object );
     
    18131811        // Set up the user editing link
    18141812        // 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) {
    18161814            $edit_link = 'profile.php';
    18171815        } else {
     
    18301828        }
    18311829
    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) )
    18331831            $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;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) )
    18351833            $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=remove&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Remove') . '</a>';
    18361834        $actions = apply_filters('user_row_actions', $actions, $user_object);
     
    22252223 */
    22262224function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
    2227     global $current_user;
    2228 
    22292225    // allow plugin to replace the popup content
    22302226    $content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) );
     
    22782274    </p>
    22792275
    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(); ?>" />
    22812277    <input type="hidden" name="action" id="action" value="" />
    22822278    <input type="hidden" name="comment_ID" id="comment_ID" value="" />
Note: See TracChangeset for help on using the changeset viewer.