WordPress.org

Make WordPress Core

Ticket #16356: 16356.patch

File 16356.patch, 1.4 KB (added by SergeyBiryukov, 4 years ago)
  • wp-admin/includes/class-wp-users-list-table.php

     
    4242                $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page'; 
    4343                $users_per_page = $this->get_items_per_page( $per_page ); 
    4444 
    45                 $paged = $this->get_pagenum(); 
     45                $users_of_blog = count_users(); 
     46                $total_pages = ceil( $users_of_blog['total_users'] / $users_per_page ); 
    4647 
     48                $paged = min( $total_pages, $this->get_pagenum() ); 
     49 
    4750                $args = array( 
    4851                        'number' => $users_per_page, 
    4952                        'offset' => ( $paged-1 ) * $users_per_page, 
  • wp-admin/users.php

     
    1313        wp_die( __( 'Cheatin’ uh?' ) ); 
    1414 
    1515$wp_list_table = _get_list_table('WP_Users_List_Table'); 
     16$pagenum = $wp_list_table->get_pagenum(); 
    1617 
    1718$title = __('Users'); 
    1819$parent_file = 'users.php'; 
     
    291292 
    292293        $wp_list_table->prepare_items(); 
    293294 
     295        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
     296        if ( $pagenum > $total_pages && $total_pages > 0 ) { 
     297                wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
     298                exit; 
     299        } 
     300 
    294301        include('./admin-header.php'); 
    295302 
    296303        $messages = array();