Ticket #27088: 27088.diff
File 27088.diff, 1.7 KB (added by , 11 years ago) |
---|
-
src/wp-includes/query.php
2974 2974 2975 2975 // Check post status to determine if post should be displayed. 2976 2976 if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) { 2977 $display = true; 2977 2978 $status = get_post_status($this->posts[0]); 2978 2979 $post_status_obj = get_post_status_object($status); 2979 //$type = get_post_type($this->posts[0]);2980 2980 if ( !$post_status_obj->public ) { 2981 2981 if ( ! is_user_logged_in() ) { 2982 2982 // User must be logged in to view unpublished posts. 2983 $ this->posts = array();2983 $display = false; 2984 2984 } else { 2985 2985 if ( $post_status_obj->protected ) { 2986 2986 // User must have edit permissions on the draft to preview. 2987 2987 if ( ! current_user_can($edit_cap, $this->posts[0]->ID) ) { 2988 $ this->posts = array();2988 $display = false; 2989 2989 } else { 2990 2990 $this->is_preview = true; 2991 2991 if ( 'future' != $status ) … … 2993 2993 } 2994 2994 } elseif ( $post_status_obj->private ) { 2995 2995 if ( ! current_user_can($read_cap, $this->posts[0]->ID) ) 2996 $ this->posts = array();2996 $display = false; 2997 2997 } else { 2998 $ this->posts = array();2998 $display = false; 2999 2999 } 3000 3000 } 3001 3001 } 3002 3002 3003 if ( ! apply_filters( 'user_can_view_post', $display, $post_status_obj ) ) { 3004 $this->posts = array(); 3005 // and/or: store the old results in a WP_Query property? could be resurrected on the the_posts filter 3006 } 3007 3003 3008 if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) 3004 3009 $this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) ); 3005 3010 }