summaryrefslogtreecommitdiffstats
path: root/wp-admin/wpmu-users.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-12-04 16:12:51 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-12-04 16:12:51 +0000
commitcd58b5b71d1a3b0ac8bd44fd49205b27b1a057de (patch)
treeacad42a53e5b90b22154aa71b3bdd8b6fd5336cd /wp-admin/wpmu-users.php
parent2f2c360db1381ff7c8f664f2e91d8688581252d4 (diff)
downloadwordpress-mu-cd58b5b71d1a3b0ac8bd44fd49205b27b1a057de.tar.gz
wordpress-mu-cd58b5b71d1a3b0ac8bd44fd49205b27b1a057de.tar.xz
wordpress-mu-cd58b5b71d1a3b0ac8bd44fd49205b27b1a057de.zip
Pagination, props ktlee, fixes #518
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1170 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/wpmu-users.php')
-rw-r--r--wp-admin/wpmu-users.php50
1 files changed, 27 insertions, 23 deletions
diff --git a/wp-admin/wpmu-users.php b/wp-admin/wpmu-users.php
index 96c016c..5e92012 100644
--- a/wp-admin/wpmu-users.php
+++ b/wp-admin/wpmu-users.php
@@ -39,8 +39,8 @@ if ( $_GET['updated'] == 'true' ) {
<div class="wrap">
<?php
- $start = isset( $_GET['start'] ) ? intval( $_GET['start'] ) : 0;
- $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 30;
+ $apage = isset( $_GET['apage'] ) ? intval( $_GET['apage'] ) : 1;
+ $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 15;
$query = "SELECT * FROM {$wpdb->users}";
@@ -67,29 +67,29 @@ if ( $_GET['updated'] == 'true' ) {
$query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
- $query .= " LIMIT " . intval( $start ) . ", " . intval( $num );
- $user_list = $wpdb->get_results( $query, ARRAY_A );
+ if( !empty($_GET['s'])) {
+ $user_list = $wpdb->get_results( $query, ARRAY_A );
+ $total = count($user_list);
+ } else {
+ $total = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->users}");
+ }
+
+ $query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num );
- $next = ( count( $user_list ) < $num ) ? false : true;
+ $user_list = $wpdb->get_results( $query, ARRAY_A );
+
+ // Pagination
+ $user_navigation = paginate_links( array(
+ 'base' => add_query_arg( 'apage', '%#%' ),
+ 'format' => '',
+ 'total' => ceil($total / $num),
+ 'current' => $apage
+ ));
?>
<h2><?php _e("Users"); ?></h2>
- <div style="float:right; padding:0 20px; margin-top:10px;">
- <h4 style="margin:0 0 4px;"><?php _e('User Navigation') ?></h4>
- <?php
- $url2 = "order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s=" .$_GET['s'];
- if( $start == 0 ) {
- _e('Previous&nbsp;Users');
- } elseif( $start <= 30 ) {
- echo '<a href="wpmu-users.php?start=0' . $url2 . '">'.__('Previous&nbsp;Users').'</a>';
- } else {
- echo '<a href="wpmu-users.php?start=' . ( $start - $num ) . '&' . $url2 . '">'.__('Previous&nbsp;Users').'</a>';
- }
- if ( $next ) {
- echo '&nbsp;||&nbsp;<a href="wpmu-users.php?start=' . ( $start + $num ) . '&' . $url2 . '">'.__('Next&nbsp;Users').'</a>';
- } else {
- echo '&nbsp;||&nbsp;'.__('Next&nbsp;Users');
- }
- ?>
+
+ <div style="float:right; padding:0 20px; margin-top:20px;">
+ <?php if ( $user_navigation ) echo "<p class='pagenav'>$user_navigation</p>"; ?>
</div>
<form action="wpmu-users.php" method="get" id="searchform">
@@ -158,7 +158,7 @@ if ( $_GET['updated'] == 'true' ) {
<?php if( $column_id == 'blogs' ) {
_e('Blogs');
} else { ?>
- <a href="wpmu-users.php?sortby=<?php echo $column_id ?>&amp;<?php if( $_GET['sortby'] == $column_id ) { if( $_GET['order'] == 'DESC' ) { echo "order=ASC&amp;" ; } else { echo "order=DESC&amp;"; } } ?>start=<?php echo $start ?>"><?php echo $column_display_name; ?></a>
+ <a href="wpmu-users.php?sortby=<?php echo $column_id ?>&amp;<?php if( $_GET['sortby'] == $column_id ) { if( $_GET['order'] == 'DESC' ) { echo "order=ASC&amp;" ; } else { echo "order=DESC&amp;"; } } ?>apage=<?php echo $apage ?>"><?php echo $column_display_name; ?></a>
<?php } ?>
</th>
<?php } ?>
@@ -249,6 +249,10 @@ if ( $_GET['updated'] == 'true' ) {
</tbody>
</table>
+ <div style="float:right; padding:0 20px; margin-top:20px;">
+ <?php if ( $user_navigation ) echo "<p class='pagenav'>$user_navigation</p>"; ?>
+ </div>
+
<p><input class="button" type="button" value="<?php _e('Check All') ?>" onclick="this.value=check_all_rows()" /></p>
<h3><?php _e('Selected Users:') ?></h3>