Don't show private and draft pages in post lists. fixes #2442

git-svn-id: http://svn.automattic.com/wordpress/trunk@3528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-02-14 06:23:03 +00:00
parent ecb85e38bb
commit bcb996e5d3
3 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@
function get_users_drafts( $user_id ) { function get_users_drafts( $user_id ) {
global $wpdb; global $wpdb;
$user_id = (int) $user_id; $user_id = (int) $user_id;
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC"; $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC";
$query = apply_filters('get_users_drafts', $query); $query = apply_filters('get_users_drafts', $query);
return $wpdb->get_results( $query ); return $wpdb->get_results( $query );
} }
@ -19,7 +19,7 @@ function get_others_drafts( $user_id ) {
$other_drafts = ''; $other_drafts = '';
} else { } else {
$editable = join(',', $editable); $editable = join(',', $editable);
$other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' "); $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
} }
return apply_filters('get_others_drafts', $other_drafts); return apply_filters('get_others_drafts', $other_drafts);

View File

@ -84,7 +84,7 @@ if ( is_month() ) {
</fieldset> </fieldset>
</form> </form>
<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_date != '0000-00-00 00:00:00' ORDER BY post_date DESC"); <?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC");
if ( count($arc_result) ) { ?> if ( count($arc_result) ) { ?>

View File

@ -587,7 +587,7 @@ class WP_Query {
} elseif ($this->is_single) { } elseif ($this->is_single) {
$where .= ' AND (post_type = "post")'; $where .= ' AND (post_type = "post")';
} else { } else {
$where .= ' AND (post_type = "post" AND post_status = "publish"'; $where .= ' AND (post_type = "post" AND (post_status = "publish"';
if ( $pagenow == 'post.php' || $pagenow == 'edit.php' ) if ( $pagenow == 'post.php' || $pagenow == 'edit.php' )
$where .= " OR post_status = 'future'"; $where .= " OR post_status = 'future'";
@ -595,9 +595,9 @@ class WP_Query {
$distinct = 'DISTINCT'; $distinct = 'DISTINCT';
if ( is_user_logged_in() ) if ( is_user_logged_in() )
$where .= " OR post_author = $user_ID AND post_status = 'private')"; $where .= " OR post_author = $user_ID AND post_status = 'private'))";
else else
$where .= ')'; $where .= '))';
} }
// Apply filters on where and join prior to paging so that any // Apply filters on where and join prior to paging so that any