Pagination fixes. Props garyc40. fixes #16357

git-svn-id: https://develop.svn.wordpress.org/trunk@17361 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2011-01-25 19:20:20 +00:00
parent fd7c566154
commit e131cde02f
5 changed files with 35 additions and 10 deletions

View File

@ -13,6 +13,7 @@ if ( !current_user_can( $tax->cap->manage_terms ) )
wp_die( __( 'Cheatin’ uh?' ) );
$wp_list_table = _get_list_table('WP_Terms_List_Table');
$pagenum = $wp_list_table->get_pagenum();
$title = $tax->labels->name;
@ -148,13 +149,23 @@ case 'editedtag':
break;
default:
if ( ! empty($_REQUEST['_wp_http_referer']) ) {
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
$location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) );
if ( ! empty( $_REQUEST['paged'] ) )
$location = add_query_arg( 'paged', (int) $_REQUEST['paged'] );
wp_redirect( $location );
exit;
}
$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
if ( $pagenum > $total_pages ) {
wp_redirect( add_query_arg( 'paged', $total_pages ) );
exit;
}
wp_enqueue_script('admin-tags');
if ( current_user_can($tax->cap->edit_terms) )

View File

@ -427,7 +427,11 @@ switch ( $_GET['action'] ) {
wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) );
} else {
wp_redirect( network_admin_url( 'users.php' ) );
$location = network_admin_url( 'users.php' );
if ( ! empty( $_REQUEST['paged'] ) )
$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
wp_redirect( $location );
}
exit();
break;

View File

@ -17,8 +17,14 @@ if ( ! current_user_can( 'manage_network_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
$wp_list_table = _get_list_table('WP_MS_Users_List_Table');
$pagenum = $wp_list_table->get_pagenum();
$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
if ( $pagenum > $total_pages ) {
wp_redirect( add_query_arg( 'paged', $total_pages ) );
exit;
}
$title = __( 'Users' );
$parent_file = 'users.php';

View File

@ -13,7 +13,7 @@ if ( ! current_user_can( 'list_users' ) )
wp_die( __( 'Cheatin’ uh?' ) );
$wp_list_table = _get_list_table('WP_Users_List_Table');
$pagenum = $wp_list_table->get_pagenum();
$title = __('Users');
$parent_file = 'users.php';
@ -290,7 +290,11 @@ default:
}
$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
if ( $pagenum > $total_pages ) {
wp_redirect( add_query_arg( 'paged', $total_pages ) );
exit;
}
include('./admin-header.php');
$messages = array();

View File

@ -549,12 +549,12 @@ class WP_User_Query {
$this->results = $wpdb->get_col("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit");
}
if ( !$this->results )
return;
if ( $this->query_vars['count_total'] )
$this->total_users = $wpdb->get_var("SELECT COUNT(*) $this->query_from $this->query_where");
if ( !$this->results )
return;
if ( 'all_with_meta' == $this->query_vars['fields'] ) {
cache_users( $this->results );