Ticket #8592: 8592-post.php.3.diff
File 8592-post.php.3.diff, 1.0 KB (added by , 14 years ago) |
---|
-
post.php
2458 2458 * @return array List of pages matching defaults or $args 2459 2459 */ 2460 2460 function &get_pages($args = '') { 2461 global $wpdb ;2461 global $wpdb, $user_ID; 2462 2462 2463 2463 $defaults = array( 2464 2464 'child_of' => 0, 'sort_order' => 'ASC', … … 2566 2566 if ( $parent >= 0 ) 2567 2567 $where .= $wpdb->prepare(' AND post_parent = %d ', $parent); 2568 2568 2569 $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where "; 2570 $query .= $author_query; 2569 $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page'"; 2570 if ( is_admin() ) { 2571 $where .= current_user_can( "edit_private_pages" ) ? "" : " AND (post_status = 'publish' OR post_author = $user_ID AND post_status = 'private')"; 2572 } 2573 else { 2574 $where .= " AND (post_status = 'publish')"; 2575 } 2576 $query .= " $where )" . $author_query; 2571 2577 $query .= " ORDER BY " . $sort_column . " " . $sort_order ; 2572 2578 2573 2579 if ( !empty($number) )