Make WordPress Core


Ignore:
Timestamp:
06/24/2010 03:01:29 PM (13 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/post.php

    r15032 r15315  
    11711171 */
    11721172function wp_check_post_lock( $post_id ) {
    1173     global $current_user;
    1174 
    11751173    if ( !$post = get_post( $post_id ) )
    11761174        return false;
     
    11811179    $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );
    11821180
    1183     if ( $lock && $lock > time() - $time_window && $last != $current_user->ID )
     1181    if ( $lock && $lock > time() - $time_window && $last != get_current_user_id() )
    11841182        return $last;
    11851183    return false;
     
    11951193 */
    11961194function wp_set_post_lock( $post_id ) {
    1197     global $current_user;
    11981195    if ( !$post = get_post( $post_id ) )
    11991196        return false;
    1200     if ( !$current_user || !$current_user->ID )
     1197    if ( 0 == get_current_user_id() )
    12011198        return false;
    12021199
     
    12531250        $new_autosave = _wp_post_revision_fields( $_POST, true );
    12541251        $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();
    12571253        return wp_update_post( $new_autosave );
    12581254    }
Note: See TracChangeset for help on using the changeset viewer.