mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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:
+15
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user