Make WordPress Core


Ignore:
Timestamp:
07/21/2010 08:10:22 PM (14 years ago)
Author:
ryan
Message:

Use get_current_user() and get_current_user_id() instead of global current_user object. Props filofo. fixes #13934 for 3.0.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-admin/includes/post.php

    r15451 r15452  
    11731173 */
    11741174function wp_check_post_lock( $post_id ) {
    1175     global $current_user;
    1176 
    11771175    if ( !$post = get_post( $post_id ) )
    11781176        return false;
     
    11831181    $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );
    11841182
    1185     if ( $lock && $lock > time() - $time_window && $last != $current_user->ID )
     1183    if ( $lock && $lock > time() - $time_window && $last != get_current_user_id() )
    11861184        return $last;
    11871185    return false;
     
    11971195 */
    11981196function wp_set_post_lock( $post_id ) {
    1199     global $current_user;
    12001197    if ( !$post = get_post( $post_id ) )
    12011198        return false;
    1202     if ( !$current_user || !$current_user->ID )
     1199    if ( 0 == get_current_user_id() )
    12031200        return false;
    12041201
     
    12551252        $new_autosave = _wp_post_revision_fields( $_POST, true );
    12561253        $new_autosave['ID'] = $old_autosave->ID;
    1257         $current_user = wp_get_current_user();
    1258         $new_autosave['post_author'] = $current_user->ID;
     1254        $new_autosave['post_author'] = get_current_user_id();
    12591255        return wp_update_post( $new_autosave );
    12601256    }
Note: See TracChangeset for help on using the changeset viewer.