Make WordPress Core

Ticket #45954: 45954.2.diff

File 45954.2.diff, 2.8 KB (added by pbiron, 4 years ago)

same as 45954.diff but with @since updated to 5.3.0.

  • src/wp-admin/includes/class-wp-ms-sites-list-table.php

    From 6b7d7467e08ce061afbc2791255b38e9e0b3c3f7 Mon Sep 17 00:00:00 2001
    From: Paul Biron <paul@sparrowhawkcomputing.com>
    Date: Tue, 4 Jun 2019 14:31:56 -0600
    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 | 42 +++++++++++++++++++
     src/wp-admin/network/sites.php                | 14 ++++---
     2 files changed, 50 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..276ffdecc0 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.3.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.3.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                        $output = ob_get_clean();
     254                        if ( ! empty( $output ) ) {
     255                                echo $output;
     256                                submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'site-query-submit' ) );
     257                        }
     258                }
     259                ?>
     260                </div>
     261                <?php
     262                /**
     263                 * Fires immediately following the closing "actions" div in the tablenav for the
     264                 * MS sites list table.
     265                 *
     266                 * @since 5.3.0
     267                 *
     268                 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
     269                 */
     270                do_action( 'manage_sites_extra_tablenav', $which );
     271        }
     272
    231273        /**
    232274         * @return array
    233275         */
  • 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':