Ticket #8592: 8592-post.php.2.diff
File 8592-post.php.2.diff, 1.2 KB (added by , 14 years ago) |
---|
-
post.php
2153 2153 * @return array List of pages matching defaults or $args 2154 2154 */ 2155 2155 function &get_pages($args = '') { 2156 global $wpdb ;2156 global $wpdb, $user_ID; 2157 2157 2158 2158 $defaults = array( 2159 2159 'child_of' => 0, 'sort_order' => 'ASC', … … 2258 2258 if ( $parent >= 0 ) 2259 2259 $where .= $wpdb->prepare(' AND post_parent = %d ', $parent); 2260 2260 2261 $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where "; 2262 $query .= $author_query; 2261 $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page'"; 2262 $where .= " AND (post_status = 'publish'"; 2263 if ( is_admin() ) 2264 $where .= " OR post_status = 'future' OR post_status = 'draft' OR post_status = 'pending'"; 2265 if ( is_user_logged_in() ) { 2266 $where .= current_user_can( "read_private_pages" ) ? " OR post_status = 'private'" : " OR post_author = $user_ID AND post_status = 'private'"; 2267 } 2268 $where .= ')'; 2269 2270 $query .= " $where )" . $author_query; 2263 2271 $query .= " ORDER BY " . $sort_column . " " . $sort_order ; 2264 2272 2265 2273 $pages = $wpdb->get_results($query);