WordPress.org

Make WordPress Core

Ticket #39186: 39186.diff

File 39186.diff, 3.5 KB (added by engelen, 3 years ago)

Fix bulk actions problems for all object types (including terms) and fix bulk user promotion

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

    diff --git src/wp-admin/includes/class-wp-list-table.php src/wp-admin/includes/class-wp-list-table.php
    index bf642ac..9929d56 100644
    class WP_List_Table { 
    470470
    471471                echo "</select>\n";
    472472
    473                 submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
     473                submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two", 'name' => "doaction$two" ) );
    474474                echo "\n";
    475475        }
    476476
    class WP_List_Table { 
    486486                if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) )
    487487                        return false;
    488488
    489                 if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
     489                if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] && isset($_REQUEST['doaction']) )
    490490                        return $_REQUEST['action'];
    491491
    492                 if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
     492                if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] && isset($_REQUEST['doaction2']) )
    493493                        return $_REQUEST['action2'];
    494494
    495495                return false;
  • src/wp-admin/includes/class-wp-terms-list-table.php

    diff --git src/wp-admin/includes/class-wp-terms-list-table.php src/wp-admin/includes/class-wp-terms-list-table.php
    index 7d59624..efbcf2c 100644
    class WP_Terms_List_Table extends WP_List_Table { 
    164164         * @return string
    165165         */
    166166        public function current_action() {
    167                 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) )
     167                if ( isset( $_REQUEST['delete_tags'] ) && (
     168                                ( isset( $_REQUEST['doaction'] ) && 'delete' == $_REQUEST['action'] ) ||
     169                                ( isset( $_REQUEST['doaction2'] ) && 'delete' == $_REQUEST['action2'] )
     170                        ) ) {
    168171                        return 'bulk-delete';
     172                }
    169173
    170174                return parent::current_action();
    171175        }
  • src/wp-admin/includes/class-wp-users-list-table.php

    diff --git src/wp-admin/includes/class-wp-users-list-table.php src/wp-admin/includes/class-wp-users-list-table.php
    index 3b7795d..69c0582 100644
    class WP_Users_List_Table extends WP_List_Table { 
    267267                        <?php wp_dropdown_roles(); ?>
    268268                </select>
    269269        <?php
    270                         submit_button( __( 'Change' ), '', 'changeit', false );
     270                        $submit_name = 'bottom' === $which ? 'changeit2' : 'changeit';
     271                        submit_button( __( 'Change' ), '', $submit_name, false );
    271272                endif;
    272273
    273274                /**
    class WP_Users_List_Table extends WP_List_Table { 
    295296         * @return string The bulk action required.
    296297         */
    297298        public function current_action() {
    298                 if ( isset( $_REQUEST['changeit'] ) &&
    299                         ( ! empty( $_REQUEST['new_role'] ) || ! empty( $_REQUEST['new_role2'] ) ) ) {
     299                if ( ( isset( $_REQUEST['changeit'] ) && ! empty( $_REQUEST['new_role'] ) ) || ( isset( $_REQUEST['changeit2'] ) && ! empty( $_REQUEST['new_role2'] ) ) ) {
    300300                        return 'promote';
    301301                }
    302302
  • src/wp-admin/users.php

    diff --git src/wp-admin/users.php src/wp-admin/users.php
    index 214c06d..f1d29c1 100644
    case 'promote': 
    103103
    104104        $editable_roles = get_editable_roles();
    105105        $role = false;
    106         if ( ! empty( $_REQUEST['new_role2'] ) ) {
     106        if ( isset( $_REQUEST['changeit2'] ) && ! empty( $_REQUEST['new_role2'] ) ) {
    107107                $role = $_REQUEST['new_role2'];
    108         } elseif ( ! empty( $_REQUEST['new_role'] ) ) {
     108        } elseif ( isset( $_REQUEST['changeit'] ) && ! empty( $_REQUEST['new_role'] ) ) {
    109109                $role = $_REQUEST['new_role'];
    110110        }
    111111