Make WordPress Core


Ignore:
Timestamp:
10/02/2013 09:09:52 PM (11 years ago)
Author:
ocean90
Message:

Replace use of global $user_ID in favor of get_current_user_id(). fixes #25372.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r25668 r25669  
    21412141     */
    21422142    function get_posts() {
    2143         global $wpdb, $user_ID;
     2143        global $wpdb;
    21442144
    21452145        $this->parse_query();
     
    27142714            }
    27152715
     2716            $user_id = get_current_user_id();
     2717
    27162718            if ( !empty($e_status) ) {
    27172719                $statuswheres[] = "(" . join( ' AND ', $e_status ) . ")";
     
    27192721            if ( !empty($r_status) ) {
    27202722                if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) )
    2721                     $statuswheres[] = "($wpdb->posts.post_author = $user_ID " . "AND (" . join( ' OR ', $r_status ) . "))";
     2723                    $statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))";
    27222724                else
    27232725                    $statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
     
    27252727            if ( !empty($p_status) ) {
    27262728                if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) )
    2727                     $statuswheres[] = "($wpdb->posts.post_author = $user_ID " . "AND (" . join( ' OR ', $p_status ) . "))";
     2729                    $statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))";
    27282730                else
    27292731                    $statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
     
    27582760                $private_states = get_post_stati( array('private' => true) );
    27592761                foreach ( (array) $private_states as $state )
    2760                     $where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_ID AND $wpdb->posts.post_status = '$state'";
     2762                    $where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_id AND $wpdb->posts.post_status = '$state'";
    27612763            }
    27622764
Note: See TracChangeset for help on using the changeset viewer.