Ticket #48653: 48653.diff
File 48653.diff, 2.9 KB (added by , 5 years ago) |
---|
-
src/wp-includes/capabilities.php
241 241 } 242 242 243 243 $status_obj = get_post_status_object( $post->post_status ); 244 if( !$status_obj ){ 245 /* translators: 1: Post status, 2: Capability name. */ 246 _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post status %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post with that status.' ), $post->post_status, $cap ), '5.3.1' ); 247 $caps[] = 'edit_others_posts'; 248 break; 249 } 250 244 251 if ( $status_obj->public ) { 245 252 $caps[] = $post_type->cap->read; 246 253 break; -
src/wp-includes/class-wp-query.php
3056 3056 $this->is_single = true; 3057 3057 $this->is_attachment = true; 3058 3058 } 3059 $post_status_obj = get_post_status_object( $status );3060 3059 3061 3060 // If the post_status was specifically requested, let it pass through. 3062 if ( ! $post_status_obj->public && ! in_array( $status, $q_status ) ) { 3063 3064 if ( ! is_user_logged_in() ) { 3065 // User must be logged in to view unpublished posts. 3066 $this->posts = array(); 3067 } else { 3068 if ( $post_status_obj->protected ) { 3069 // User must have edit permissions on the draft to preview. 3070 if ( ! current_user_can( $edit_cap, $this->posts[0]->ID ) ) { 3071 $this->posts = array(); 3061 if ( ! in_array( $status, $q_status ) ) { 3062 $post_status_obj = get_post_status_object( $status ); 3063 if ( $post_status_obj && ! $post_status_obj->public ){ 3064 if ( ! is_user_logged_in() ) { 3065 // User must be logged in to view unpublished posts. 3066 $this->posts = array(); 3067 } else { 3068 if ( $post_status_obj->protected ) { 3069 // User must have edit permissions on the draft to preview. 3070 if ( ! current_user_can( $edit_cap, $this->posts[0]->ID ) ) { 3071 $this->posts = array(); 3072 } else { 3073 $this->is_preview = true; 3074 if ( 'future' != $status ) { 3075 $this->posts[0]->post_date = current_time( 'mysql' ); 3076 } 3077 } 3078 } elseif ( $post_status_obj->private ) { 3079 if ( ! current_user_can( $read_cap, $this->posts[0]->ID ) ) { 3080 $this->posts = array(); 3081 } 3072 3082 } else { 3073 $this->is_preview = true;3074 if ( 'future' != $status ) {3075 $this->posts[0]->post_date = current_time( 'mysql' );3076 }3077 }3078 } elseif ( $post_status_obj->private ) {3079 if ( ! current_user_can( $read_cap, $this->posts[0]->ID ) ) {3080 3083 $this->posts = array(); 3081 3084 } 3082 } else {3083 $this->posts = array();3084 3085 } 3086 } else { 3087 // Post status not registered, assume it's not public. 3088 $this->posts = array(); 3085 3089 } 3086 3090 } 3087 3091