WordPress.org

Make WordPress Core

Changeset 21192


Ignore:
Timestamp:
06/30/12 09:28:15 (3 years ago)
Author:
markjaquith
Message:

Prevent child pages from being visually promoted to the top level after Quick Edit. props ssamture. fixes #18615

Location:
trunk/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ajax-actions.php

    r21191 r21192  
    13691369 
    13701370    $mode = $_POST['post_view']; 
    1371     $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) ); 
     1371 
     1372    $level = 0; 
     1373    $request_post = array( get_post( $_POST['post_ID'] ) ); 
     1374    $parent = $request_post[0]->post_parent; 
     1375 
     1376    while ( $parent > 0 ) { 
     1377        $parent_post = get_post( $parent ); 
     1378        $parent = $parent_post->post_parent; 
     1379        $level++; 
     1380    } 
     1381 
     1382    $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level ); 
    13721383 
    13731384    wp_die(); 
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r21162 r21192  
    301301    } 
    302302 
    303     function display_rows( $posts = array() ) { 
     303    function display_rows( $posts = array(), $level = 0 ) { 
    304304        global $wp_query, $post_type_object, $per_page; 
    305305 
     
    312312            $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); 
    313313        } else { 
    314             $this->_display_rows( $posts ); 
    315         } 
    316     } 
    317  
    318     function _display_rows( $posts ) { 
     314            $this->_display_rows( $posts, $level ); 
     315        } 
     316    } 
     317 
     318    function _display_rows( $posts, $level = 0 ) { 
    319319        global $post, $mode; 
    320320 
     
    328328 
    329329        foreach ( $posts as $post ) 
    330             $this->single_row( $post ); 
     330            $this->single_row( $post, $level ); 
    331331    } 
    332332 
     
    525525                else { 
    526526                    $attributes = 'class="post-title page-title column-title"' . $style; 
     527                     
     528                    $pad = str_repeat( '— ', $level ); 
    527529?> 
    528             <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states( $post ); ?></strong> 
     530            <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); ?></strong> 
    529531<?php 
    530532                    if ( 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) ) 
Note: See TracChangeset for help on using the changeset viewer.