Make WordPress Core

Ticket #29030: 29030.diff

File 29030.diff, 2.7 KB (added by shariqkhan2012, 5 years ago)
  • src/js/_enqueues/admin/common.js

     
    110110         * @returns {string} The hidden column names separated by a comma.
    111111         */
    112112        hidden : function() {
    113                 return $( '.manage-column[id]' ).filter( ':hidden' ).map(function() {
    114                         return this.id;
     113                //Checking for unchecked column names is better and more robust than checking for hidden column headers
     114                return $( '.hide-column-tog' ).filter(':not(:checked)' ).map(function() {
     115                        return this.value;
    115116                }).get().join( ',' );
    116117        },
    117118
  • src/wp-admin/includes/ajax-actions.php

     
    15731573                wp_die( -1 );
    15741574        }
    15751575
     1576        $special = get_special_columns(); //get list of special columns that are not meant to be hidden
    15761577        $hidden = ! empty( $_POST['hidden'] ) ? explode( ',', $_POST['hidden'] ) : array();
     1578        $hidden = array_diff($hidden, $special); //remove the special columns from the list of columns to be hidden
    15771579        update_user_option( $user->ID, "manage{$page}columnshidden", $hidden, true );
    15781580
    15791581        wp_die( 1 );
  • src/wp-admin/includes/class-wp-screen.php

     
    10711071                <fieldset class="metabox-prefs">
    10721072                <legend><?php echo $legend; ?></legend>
    10731073                <?php
    1074                 $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' );
     1074                $special = get_special_columns(); //get list of special columns that are not meant to be hidden
    10751075
    10761076                foreach ( $columns as $column => $title ) {
    10771077                        // Can't hide these for they are special
  • src/wp-admin/includes/screen.php

     
    240240function set_current_screen( $hook_name = '' ) {
    241241        WP_Screen::get( $hook_name )->set_current_screen();
    242242}
     243
     244/**
     245 * Get a list of special columns.
     246 *
     247 * @since X.Y.Z
     248 *
     249 * @return array
     250 */
     251function get_special_columns() {
     252        $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' );
     253
     254        /**
     255         * Filters the list of special columns.
     256         *
     257         * @since X.Y.Z
     258         *
     259         * @param array     $special An array of special columns.
     260         */
     261        return apply_filters( 'special_columns', $special );
     262}