Don't show password protected posts in searches for non-logged in users. Props coffee2code. fixes #9559

git-svn-id: https://develop.svn.wordpress.org/trunk@11106 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-04-28 00:05:43 +00:00
parent 280ad0245d
commit 067e8ba9ee
1 changed files with 4 additions and 1 deletions

View File

@ -1759,8 +1759,11 @@ class WP_Query {
if (empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] )
$search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')";
if ( !empty($search) )
if ( !empty($search) ) {
$search = " AND ({$search}) ";
if ( !is_user_logged_in() )
$search .= " AND ($wpdb->posts.post_password = '') ";
}
}
// Category stuff