Remove private posts from front page query. Aadd private posts and page caps. fixes #2613

git-svn-id: https://develop.svn.wordpress.org/trunk@3772 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-05-11 23:13:35 +00:00
parent 104a56563c
commit 8f12196bd1
5 changed files with 32 additions and 8 deletions
+15 -5
View File
@@ -828,13 +828,23 @@ class WP_Query {
} else {
$where .= " AND (post_type = '$post_type' AND (post_status = 'publish'";
if ( is_admin() )
if ( is_admin() ) {
$where .= " OR post_status = 'future' OR post_status = 'draft'";
if ( is_user_logged_in() )
$where .= " OR post_author = $user_ID AND post_status = 'private'))";
else
$where .= '))';
if ( is_user_logged_in() ) {
if ( 'post' == $post_type )
$cap = 'edit_private_posts';
else
$cap = 'edit_private_pages';
if ( current_user_can($cap) )
$where .= "OR post_status = 'private'";
else
$where .= " OR post_author = $user_ID AND post_status = 'private'";
}
}
$where .= '))';
}
// Apply filters on where and join prior to paging so that any