Make WordPress Core

Ticket #45954: 49594.diff

File 49594.diff, 2.8 KB (added by pbiron, 5 years ago)
  • src/wp-admin/includes/class-wp-ms-sites-list-table.php

    From c49362883a84df681cbfc14a2430d8d4e98beb01 Mon Sep 17 00:00:00 2001
    From: Paul Biron <paul@sparrowhawkcomputing.com>
    Date: Thu, 21 Feb 2019 17:10:58 -0700
    Subject: [PATCH] Add a extra_tablenav() method to WP_MS_Sites_List_Table,
     which adds the new restrict_manage_sites and manage_sites_extra_tablenav
     filters.
    
    ---
     .../includes/class-wp-ms-sites-list-table.php | 45 +++++++++++++++++++
     src/wp-admin/network/sites.php                | 14 +++---
     2 files changed, 53 insertions(+), 6 deletions(-)
    
    diff --git a/src/wp-admin/includes/class-wp-ms-sites-list-table.php b/src/wp-admin/includes/class-wp-ms-sites-list-table.php
    index c9399b220b..e2c8372590 100644
    a b class WP_MS_Sites_List_Table extends WP_List_Table { 
    228228                }
    229229        }
    230230
     231        /**
     232         * Extra controls to be displayed between bulk actions and pagination.
     233         *
     234         * @since 5.2.0
     235         *
     236         * @param string $which
     237         */
     238        protected function extra_tablenav( $which ) {
     239                ?>
     240                <div class="alignleft actions">
     241                <?php
     242                if ( 'top' === $which ) {
     243                        ob_start();
     244
     245                        /**
     246                         * Fires before the Filter button on the MS sites list table.
     247                         *
     248                         * @since 5.2.0
     249                         *
     250                         * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
     251                         */
     252                        do_action( 'restrict_manage_sites', $which );
     253
     254                        $output = ob_get_clean();
     255
     256                        if ( ! empty( $output ) ) {
     257                                echo $output;
     258                                submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'site-query-submit' ) );
     259                        }
     260                }
     261
     262                ?>
     263                </div>
     264                <?php
     265                /**
     266                 * Fires immediately following the closing "actions" div in the tablenav for the
     267                 * MS sites list table.
     268                 *
     269                 * @since 5.2.0
     270                 *
     271                 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
     272                 */
     273                do_action( 'manage_sites_extra_tablenav', $which );
     274        }
     275
    231276        /**
    232277         * @return array
    233278         */
  • src/wp-admin/network/sites.php

    diff --git a/src/wp-admin/network/sites.php b/src/wp-admin/network/sites.php
    index 6c2de15866..2794d9f849 100644
    a b if ( isset( $_GET['action'] ) ) { 
    215215                                        wp_safe_redirect( $redirect_to );
    216216                                        exit();
    217217                                }
    218                         } else {
    219                                 $location = network_admin_url( 'sites.php' );
    220                                 if ( ! empty( $_REQUEST['paged'] ) ) {
    221                                         $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
    222                                 }
    223                                 wp_redirect( $location );
     218                        }
     219                        elseif ( ! empty( $_POST['_wp_http_referer'] ) ) {
     220                                // process query defined by WP_MS_Site_List_Table::extra_table_nav().
     221                                $query_args = $_POST;
     222                                unset( $query_args['_wp_http_referer'], $query_args['_wpnonce'] );
     223
     224                                wp_safe_redirect( add_query_arg( $query_args, network_admin_url( 'sites.php' ) ) );
    224225                                exit();
    225226                        }
     227
    226228                        break;
    227229
    228230                case 'archiveblog':