From bcb996e5d3b129cbc8214fcf558e511cab9850b0 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 14 Feb 2006 06:23:03 +0000 Subject: [PATCH] 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 --- wp-admin/admin-db.php | 4 ++-- wp-admin/edit.php | 2 +- wp-includes/classes.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index 67c4de93a0..51021e2608 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -3,7 +3,7 @@ function get_users_drafts( $user_id ) { global $wpdb; $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); return $wpdb->get_results( $query ); } @@ -19,7 +19,7 @@ function get_others_drafts( $user_id ) { $other_drafts = ''; } else { $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); diff --git a/wp-admin/edit.php b/wp-admin/edit.php index a77ccba57e..17768090fe 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -84,7 +84,7 @@ if ( is_month() ) { -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"); +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) ) { ?> diff --git a/wp-includes/classes.php b/wp-includes/classes.php index a8dbe7c9fc..f4a4b6b6ac 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -587,7 +587,7 @@ class WP_Query { } elseif ($this->is_single) { $where .= ' AND (post_type = "post")'; } 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' ) $where .= " OR post_status = 'future'"; @@ -595,9 +595,9 @@ class WP_Query { $distinct = 'DISTINCT'; 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 - $where .= ')'; + $where .= '))'; } // Apply filters on where and join prior to paging so that any