Make WordPress Core

Changeset 17361


Ignore:
Timestamp:
01/25/2011 07:20:20 PM (14 years ago)
Author:
ryan
Message:

Pagination fixes. Props garyc40. fixes #16357

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-tags.php

    r17322 r17361  
    1414
    1515$wp_list_table = _get_list_table('WP_Terms_List_Table');
     16$pagenum = $wp_list_table->get_pagenum();
    1617
    1718$title = $tax->labels->name;
     
    149150
    150151default:
    151 
    152152if ( ! empty($_REQUEST['_wp_http_referer']) ) {
    153      wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
    154      exit;
     153    $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) );
     154
     155    if ( ! empty( $_REQUEST['paged'] ) )
     156        $location = add_query_arg( 'paged', (int) $_REQUEST['paged'] );
     157   
     158    wp_redirect( $location );
     159    exit;
    155160}
    156161
    157162$wp_list_table->prepare_items();
     163$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
     164
     165if ( $pagenum > $total_pages ) {
     166    wp_redirect( add_query_arg( 'paged', $total_pages ) );
     167    exit;
     168}
    158169
    159170wp_enqueue_script('admin-tags');
  • trunk/wp-admin/network/edit.php

    r17360 r17361  
    428428            wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) );
    429429        } else {
    430             wp_redirect( network_admin_url( 'users.php' ) );
     430            $location = network_admin_url( 'users.php' );
     431
     432            if ( ! empty( $_REQUEST['paged'] ) )
     433                $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
     434            wp_redirect( $location );
    431435        }
    432436        exit();
  • trunk/wp-admin/network/users.php

    r17322 r17361  
    1818
    1919$wp_list_table = _get_list_table('WP_MS_Users_List_Table');
     20$pagenum = $wp_list_table->get_pagenum();
    2021$wp_list_table->prepare_items();
     22$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
    2123
     24if ( $pagenum > $total_pages ) {
     25    wp_redirect( add_query_arg( 'paged', $total_pages ) );
     26    exit;
     27}
    2228$title = __( 'Users' );
    2329$parent_file = 'users.php';
  • trunk/wp-admin/users.php

    r17345 r17361  
    1414
    1515$wp_list_table = _get_list_table('WP_Users_List_Table');
    16 
     16$pagenum = $wp_list_table->get_pagenum();
    1717$title = __('Users');
    1818$parent_file = 'users.php';
     
    291291
    292292    $wp_list_table->prepare_items();
    293 
     293    $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
     294    if ( $pagenum > $total_pages ) {
     295        wp_redirect( add_query_arg( 'paged', $total_pages ) );
     296        exit;
     297    }
    294298    include('./admin-header.php');
    295299
  • trunk/wp-includes/user.php

    r17228 r17361  
    543543    function query() {
    544544        global $wpdb;
    545 
     545       
    546546        if ( is_array( $this->query_vars['fields'] ) || 'all' == $this->query_vars['fields'] ) {
    547547            $this->results = $wpdb->get_results("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit");
     
    549549            $this->results = $wpdb->get_col("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit");
    550550        }
     551       
     552        if ( $this->query_vars['count_total'] )
     553            $this->total_users = $wpdb->get_var("SELECT COUNT(*) $this->query_from $this->query_where");
    551554
    552555        if ( !$this->results )
    553556            return;
    554 
    555         if ( $this->query_vars['count_total'] )
    556             $this->total_users = $wpdb->get_var("SELECT COUNT(*) $this->query_from $this->query_where");
    557557
    558558        if ( 'all_with_meta' == $this->query_vars['fields'] ) {
Note: See TracChangeset for help on using the changeset viewer.