Make WordPress Core

Ticket #8592: 8592.2.diff

File 8592.2.diff, 3.5 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.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 ( count( array_diff( (array) $post_status, get_post_stati() ) ) )
    33143314                return false;
    33153315
    33163316        $cache = array();
     
    34053405        if ( $parent >= 0 )
    34063406                $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
    34073407
    3408         $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status );
     3408        if ( !is_array($post_status) ) {
     3409                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $post_type, $post_status );
     3410        } else {
     3411                $post_status = implode( "', '", $post_status );
     3412                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $post_type );
     3413        }
    34093414
    34103415        $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
    34113416        $query .= $author_query;