Make WordPress Core

Ticket #8592: 8592.4.diff

File 8592.4.diff, 4.0 KB (added by SergeyBiryukov, 12 years ago)
  • wp-admin/includes/class-wp-posts-list-table.php

     
    845845                        <label>
    846846                                <span class="title"><?php _e( 'Parent' ); ?></span>
    847847        <?php
    848                 $dropdown_args = array( 'post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __( 'Main Page (no parent)' ), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title' );
     848                if ( current_user_can( $post_type_object->cap->read_private_posts ) )
     849                        $post_status = array( 'publish', 'private' );
     850                else
     851                        $post_status = 'publish';
     852
     853                $dropdown_args = array(
     854                        'post_type' => $post_type_object->name,
     855                        'selected' => $post->post_parent,
     856                        'name' => 'post_parent',
     857                        'show_option_none' => __( 'Main Page (no parent)' ),
     858                        'option_none_value' => 0,
     859                        'sort_column'=> 'menu_order, post_title',
     860                        'post_status' => $post_status
     861                );
    849862                if ( $bulk )
    850863                        $dropdown_args['show_option_no_change'] =  __( '&mdash; No Change &mdash;' );
    851864                $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
  • wp-admin/includes/meta-boxes.php

     
    557557function page_attributes_meta_box($post) {
    558558        $post_type_object = get_post_type_object($post->post_type);
    559559        if ( $post_type_object->hierarchical ) {
    560                 $pages = wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column'=> 'menu_order, post_title', 'echo' => 0));
     560                if ( current_user_can( $post_type_object->cap->read_private_posts ) )
     561                        $post_status = array( 'publish', 'private' );
     562                else
     563                        $post_status = 'publish';
     564
     565                $pages = wp_dropdown_pages( array(
     566                        'post_type' => $post->post_type,
     567                        'exclude_tree' => $post->ID,
     568                        'selected' => $post->post_parent,
     569                        'name' => 'parent_id',
     570                        'show_option_none' => __( '(no parent)' ),
     571                        'sort_column'=> 'menu_order, post_title',
     572                        'echo' => 0,
     573                        'post_status' => $post_status
     574                ) );
    561575                if ( ! empty($pages) ) {
    562576?>
    563577<p><strong><?php _e('Parent') ?></strong></p>
  • wp-includes/post-template.php

     
    760760                'selected' => 0, 'echo' => 1,
    761761                'name' => 'page_id', 'id' => '',
    762762                'show_option_none' => '', 'show_option_no_change' => '',
    763                 'option_none_value' => ''
     763                'option_none_value' => '',
     764                'post_status' => 'publish'
    764765        );
    765766
    766767        $r = wp_parse_args( $args, $defaults );
  • wp-includes/post.php

     
    33103310                return false;
    33113311
    33123312        // Make sure we have a valid post status
    3313         if ( !in_array($post_status, get_post_stati()) )
     3313        if ( !is_array( $post_status ) )
     3314                $post_status = explode( ',', $post_status );
     3315        if ( count( array_diff( $post_status, get_post_stati() ) ) )
    33143316                return false;
    33153317
    33163318        $cache = array();
     
    34053407        if ( $parent >= 0 )
    34063408                $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
    34073409
    3408         $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status );
     3410        if ( 1 == count( $post_status ) ) {
     3411                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $post_type, array_shift( $post_status ) );
     3412        } else {
     3413                $post_status = implode( "', '", $post_status );
     3414                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $post_type );
     3415        }
    34093416
    34103417        $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
    34113418        $query .= $author_query;