Changeset 5575 for trunk/wp-includes/query.php
- Timestamp:
- 05/28/2007 06:34:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r5530 r5575 996 996 997 997 if ( $this->is_attachment ) { 998 $where .= " AND (post_type = 'attachment')";998 $where .= " AND post_type = 'attachment'"; 999 999 } elseif ($this->is_page) { 1000 $where .= " AND (post_type = 'page')";1000 $where .= " AND post_type = 'page'"; 1001 1001 } elseif ($this->is_single) { 1002 $where .= " AND (post_type = 'post')";1002 $where .= " AND post_type = 'post'"; 1003 1003 } else { 1004 $where .= " AND (post_type = '$post_type' AND (post_status = 'publish'"; 1004 $where .= " AND post_type = '$post_type'"; 1005 } 1006 1007 if ( isset($q['post_status']) && '' != $q['post_status'] ) { 1008 $q_status = explode(',', $q['post_status']); 1009 $r_status = array(); 1010 if ( in_array( 'draft' , $q_status ) ) 1011 $r_status[] = "post_status = 'draft'"; 1012 if ( in_array( 'future' , $q_status ) ) 1013 $r_status[] = "post_status = 'future'"; 1014 if ( in_array( 'inherit' , $q_status ) ) 1015 $r_status[] = "post_status = 'inherit'"; 1016 if ( in_array( 'private', $q_status ) ) 1017 $r_status[] = "post_status = 'private'"; 1018 if ( in_array( 'publish', $q_status ) ) 1019 $r_status[] = "post_status = 'publish'"; 1020 if ( !empty($r_status) ) 1021 $where .= " AND (" . join( ' OR ', $r_status ) . ")"; 1022 } elseif ( !$this->is_singular ) { 1023 $where .= " AND (post_status = 'publish'"; 1005 1024 1006 1025 if ( is_admin() ) 1007 1026 $where .= " OR post_status = 'future' OR post_status = 'draft'"; 1008 1027 1009 if ( is_user_logged_in() ) { 1010 if ( 'post' == $post_type ) 1011 $cap = 'read_private_posts'; 1012 else 1013 $cap = 'read_private_pages'; 1014 1015 if ( current_user_can($cap) ) 1016 $where .= " OR post_status = 'private'"; 1017 else 1018 $where .= " OR post_author = $user_ID AND post_status = 'private'"; 1019 } 1020 1021 $where .= '))'; 1028 $where .= current_user_can( "read_private_{$post_type}s" ) ? " OR post_status = 'private'" : " OR post_author = $user_ID AND post_status = 'private'"; 1029 1030 $where .= ')'; 1022 1031 } 1023 1032
Note: See TracChangeset
for help on using the changeset viewer.