Make WordPress Core


Ignore:
Timestamp:
02/09/2006 10:03:48 AM (21 years ago)
Author:
ryan
Message:

Allow draft pages. Use post_type for object types. Reserve post_status strictly for status. fixes #1820

File:
1 edited

Legend:

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

    r3484 r3510  
    594594
    595595                if ( $this->is_attachment ) {
    596                         $where .= ' AND (post_status = "attachment")';
     596                        $where .= ' AND (post_type = "attachment")';
    597597                } elseif ($this->is_page) {
    598                         $where .= ' AND (post_status = "static")';
     598                        $where .= ' AND (post_type = "page")';
    599599                } elseif ($this->is_single) {
    600                         $where .= ' AND (post_status != "static")';
     600                        $where .= ' AND (post_type = "post")';
    601601                } else {
    602                         $where .= ' AND (post_status = "publish"';
     602                        $where .= ' AND (post_type = "post" AND post_status = "publish"';
    603603
    604604                        if (isset($user_ID) && ('' != intval($user_ID)))
    605                                 $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";
     605                                $where .= " OR post_author = $user_ID AND post_status = 'private')";
    606606                        else
    607607                                $where .= ')';                         
    608608                }
    609 
    610                 if (! $this->is_attachment )
    611                         $where .= ' AND post_status != "attachment"';
    612609
    613610                // Apply filters on where and join prior to paging so that any
    … …  
    655652
    656653                // Check post status to determine if post should be displayed.
    657                 if ($this->is_single) {
     654                if ($this->is_single || $this->is_page) {
    658655                        $status = get_post_status($this->posts[0]);
    659                         if ( ('publish' != $status) && ('static' != $status) ) {
    660                                 if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) {
     656                        if ( ('publish' != $status) ) {
     657                                if ( ! is_user_logged_in() ) {
    661658                                        // User must be logged in to view unpublished posts.
    662659                                        $this->posts = array();
Note: See TracChangeset for help on using the changeset viewer.