Make WordPress Core

Changeset 48670


Ignore:
Timestamp:
07/28/2020 04:53:03 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Administration: Don't override the $mode global in WP_Screen::render_view_mode() if it's already set.

Follow-up to [48398], [48423], [48424], [48450].

See #49715.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r48594 r48670  
    7979
    8080        /**
     81         * @global string $mode           List table view mode.
    8182         * @global int    $post_id
    8283         * @global string $comment_status
    … …  
    8586         */
    8687        public function prepare_items() {
    87                 global $post_id, $comment_status, $comment_type, $search;
     88                global $mode, $post_id, $comment_status, $comment_type, $search;
    8889
    8990                if ( ! empty( $_REQUEST['mode'] ) ) {
    9091                        $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
    9192                        set_user_setting( 'posts_list_mode', $mode );
     93                } else {
     94                        $mode = get_user_setting( 'posts_list_mode', 'list' );
    9295                }
    9396
  • trunk/src/wp-admin/includes/class-wp-screen.php

    r48668 r48670  
    13141314                }
    13151315
    1316                 $mode = get_user_setting( 'posts_list_mode', 'list' );
     1316                if ( ! isset( $mode ) ) {
     1317                        $mode = get_user_setting( 'posts_list_mode', 'list' );
     1318                }
    13171319
    13181320                // This needs a submit button.
Note: See TracChangeset for help on using the changeset viewer.