<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[17361] trunk: Pagination fixes.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17361">17361</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2011-01-25 19:20:20 +0000 (Tue, 25 Jan 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Pagination fixes. Props garyc40. fixes <a href="http://trac.wordpress.org/ticket/16357">#16357</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminedittagsphp">trunk/wp-admin/edit-tags.php</a></li>
<li><a href="#trunkwpadminnetworkeditphp">trunk/wp-admin/network/edit.php</a></li>
<li><a href="#trunkwpadminnetworkusersphp">trunk/wp-admin/network/users.php</a></li>
<li><a href="#trunkwpadminusersphp">trunk/wp-admin/users.php</a></li>
<li><a href="#trunkwpincludesuserphp">trunk/wp-includes/user.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminedittagsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tags.php (17360 => 17361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tags.php        2011-01-25 17:39:10 UTC (rev 17360)
+++ trunk/wp-admin/edit-tags.php        2011-01-25 19:20:20 UTC (rev 17361)
</span><span class="lines">@@ -13,6 +13,7 @@
</span><span class="cx">         wp_die( __( 'Cheatin&#8217; uh?' ) );
</span><span class="cx">
</span><span class="cx"> $wp_list_table = _get_list_table('WP_Terms_List_Table');
</span><ins>+$pagenum = $wp_list_table->get_pagenum();
</ins><span class="cx">
</span><span class="cx"> $title = $tax->labels->name;
</span><span class="cx">
</span><span class="lines">@@ -148,14 +149,24 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> default:
</span><ins>+if ( ! empty($_REQUEST['_wp_http_referer']) ) {
+        $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) );
</ins><span class="cx">
</span><del>-if ( ! empty($_REQUEST['_wp_http_referer']) ) {
-         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
-         exit;
</del><ins>+        if ( ! empty( $_REQUEST['paged'] ) )
+                $location = add_query_arg( 'paged', (int) $_REQUEST['paged'] );
+        
+        wp_redirect( $location );
+        exit;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $wp_list_table->prepare_items();
</span><ins>+$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
</ins><span class="cx">
</span><ins>+if ( $pagenum > $total_pages ) {
+        wp_redirect( add_query_arg( 'paged', $total_pages ) );
+        exit;
+}
+
</ins><span class="cx"> wp_enqueue_script('admin-tags');
</span><span class="cx"> if ( current_user_can($tax->cap->edit_terms) )
</span><span class="cx">         wp_enqueue_script('inline-edit-tax');
</span></span></pre></div>
<a id="trunkwpadminnetworkeditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/edit.php (17360 => 17361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/edit.php        2011-01-25 17:39:10 UTC (rev 17360)
+++ trunk/wp-admin/network/edit.php        2011-01-25 19:20:20 UTC (rev 17361)
</span><span class="lines">@@ -427,7 +427,11 @@
</span><span class="cx">
</span><span class="cx">                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) );
</span><span class="cx">                 } else {
</span><del>-                        wp_redirect( network_admin_url( 'users.php' ) );
</del><ins>+                        $location = network_admin_url( 'users.php' );
+
+                        if ( ! empty( $_REQUEST['paged'] ) )
+                                $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
+                        wp_redirect( $location );
</ins><span class="cx">                 }
</span><span class="cx">                 exit();
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkwpadminnetworkusersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/users.php (17360 => 17361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/users.php        2011-01-25 17:39:10 UTC (rev 17360)
+++ trunk/wp-admin/network/users.php        2011-01-25 19:20:20 UTC (rev 17361)
</span><span class="lines">@@ -17,8 +17,14 @@
</span><span class="cx">         wp_die( __( 'You do not have permission to access this page.' ) );
</span><span class="cx">
</span><span class="cx"> $wp_list_table = _get_list_table('WP_MS_Users_List_Table');
</span><ins>+$pagenum = $wp_list_table->get_pagenum();
</ins><span class="cx"> $wp_list_table->prepare_items();
</span><ins>+$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
</ins><span class="cx">
</span><ins>+if ( $pagenum > $total_pages ) {
+        wp_redirect( add_query_arg( 'paged', $total_pages ) );
+        exit;
+}
</ins><span class="cx"> $title = __( 'Users' );
</span><span class="cx"> $parent_file = 'users.php';
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminusersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/users.php (17360 => 17361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/users.php        2011-01-25 17:39:10 UTC (rev 17360)
+++ trunk/wp-admin/users.php        2011-01-25 19:20:20 UTC (rev 17361)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx">         wp_die( __( 'Cheatin&#8217; uh?' ) );
</span><span class="cx">
</span><span class="cx"> $wp_list_table = _get_list_table('WP_Users_List_Table');
</span><del>-
</del><ins>+$pagenum = $wp_list_table->get_pagenum();
</ins><span class="cx"> $title = __('Users');
</span><span class="cx"> $parent_file = 'users.php';
</span><span class="cx">
</span><span class="lines">@@ -290,7 +290,11 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $wp_list_table->prepare_items();
</span><del>-
</del><ins>+        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
+        if ( $pagenum > $total_pages ) {
+                wp_redirect( add_query_arg( 'paged', $total_pages ) );
+                exit;
+        }
</ins><span class="cx">         include('./admin-header.php');
</span><span class="cx">
</span><span class="cx">         $messages = array();
</span></span></pre></div>
<a id="trunkwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/user.php (17360 => 17361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/user.php        2011-01-25 17:39:10 UTC (rev 17360)
+++ trunk/wp-includes/user.php        2011-01-25 19:20:20 UTC (rev 17361)
</span><span class="lines">@@ -542,19 +542,19 @@
</span><span class="cx">          */
</span><span class="cx">         function query() {
</span><span class="cx">                 global $wpdb;
</span><del>-
</del><ins>+                
</ins><span class="cx">                 if ( is_array( $this->query_vars['fields'] ) || 'all' == $this->query_vars['fields'] ) {
</span><span class="cx">                         $this->results = $wpdb->get_results("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit");
</span><span class="cx">                 } else {
</span><span class="cx">                         $this->results = $wpdb->get_col("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit");
</span><span class="cx">                 }
</span><ins>+                
+                if ( $this->query_vars['count_total'] )
+                        $this->total_users = $wpdb->get_var("SELECT COUNT(*) $this->query_from $this->query_where");
</ins><span class="cx">
</span><span class="cx">                 if ( !$this->results )
</span><span class="cx">                         return;
</span><span class="cx">
</span><del>-                if ( $this->query_vars['count_total'] )
-                        $this->total_users = $wpdb->get_var("SELECT COUNT(*) $this->query_from $this->query_where");
-
</del><span class="cx">                 if ( 'all_with_meta' == $this->query_vars['fields'] ) {
</span><span class="cx">                         cache_users( $this->results );
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>