Make WordPress Core


Ignore:
Timestamp:
05/11/2006 11:13:35 PM (20 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r3767 r3772  
    829829            $where .= " AND (post_type = '$post_type' AND (post_status = 'publish'";
    830830
    831             if ( is_admin() )
     831            if ( is_admin() ) {
    832832                $where .= " OR post_status = 'future' OR post_status = 'draft'";
    833833   
    834             if ( is_user_logged_in() )
    835                 $where .= " OR post_author = $user_ID AND post_status = 'private'))";
    836             else
    837                 $where .= '))';
     834                if ( is_user_logged_in() ) {
     835                    if ( 'post' == $post_type )
     836                        $cap = 'edit_private_posts';
     837                    else
     838                        $cap = 'edit_private_pages';
     839
     840                    if ( current_user_can($cap) )
     841                        $where .= "OR post_status = 'private'";
     842                    else
     843                    $where .= " OR post_author = $user_ID AND post_status = 'private'";
     844                }
     845            }
     846
     847            $where .= '))';
    838848        }
    839849
Note: See TracChangeset for help on using the changeset viewer.