Ticket #2613: private.2.diff

File private.2.diff, 1.5 KB (added by ryan, 6 years ago)

Restore private posts on front page and label them

  • wp-includes/post-template.php

     
    3434        $title = $post->post_title; 
    3535        if ( !empty($post->post_password) ) 
    3636                $title = sprintf(__('Protected: %s'), $title); 
     37        else if ( 'private' == $post->post_status ) 
     38                $title = sprintf(__('Private: %s'), $title); 
    3739 
    3840        return $title; 
    3941} 
  • wp-includes/query.php

     
    850850                } else { 
    851851                        $where .= " AND (post_type = '$post_type' AND (post_status = 'publish'"; 
    852852 
    853                         if ( is_admin() ) { 
     853                        if ( is_admin() ) 
    854854                                $where .= " OR post_status = 'future' OR post_status = 'draft'"; 
    855855         
    856                                 if ( is_user_logged_in() ) { 
    857                                         if ( 'post' == $post_type ) 
    858                                                 $cap = 'edit_private_posts'; 
    859                                         else 
    860                                                 $cap = 'edit_private_pages'; 
     856                        if ( is_user_logged_in() ) { 
     857                                if ( 'post' == $post_type ) 
     858                                        $cap = 'edit_private_posts'; 
     859                                else 
     860                                        $cap = 'edit_private_pages'; 
    861861 
    862                                         if ( current_user_can($cap) ) 
    863                                                 $where .= "OR post_status = 'private'"; 
    864                                         else 
    865                                         $where .= " OR post_author = $user_ID AND post_status = 'private'"; 
    866                                 } 
     862                                if ( current_user_can($cap) ) 
     863                                        $where .= " OR post_status = 'private'"; 
     864                                else 
     865                                $where .= " OR post_author = $user_ID AND post_status = 'private'"; 
    867866                        } 
    868867 
    869868                        $where .= '))';