]> git.mxchange.org Git - friendica.git/commitdiff
add pagination to admin/user page to support large numbers of users
authorFriendika <info@friendika.com>
Fri, 17 Jun 2011 23:21:11 +0000 (16:21 -0700)
committerFriendika <info@friendika.com>
Fri, 17 Jun 2011 23:21:11 +0000 (16:21 -0700)
boot.php
mod/admin.php

index 673623fafc318eba1bbc13012a415b0faf16fca5..f369856403bc36f4a5cc804e51edf48650947fd3 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -4,7 +4,7 @@ set_time_limit(0);
 ini_set('pcre.backtrack_limit', 250000);
 
 
-define ( 'FRIENDIKA_VERSION',      '2.2.1013' );
+define ( 'FRIENDIKA_VERSION',      '2.2.1014' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
 define ( 'DB_UPDATE_VERSION',      1063      );
 
index e657c805332dd732711da2363b78ca125f0ffc44..e452ea856f8a55cea77a4752ad81eb310ade1bc4 100644 (file)
@@ -385,6 +385,13 @@ function admin_page_users(&$a){
                                 LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;");
        
        /* get users */
+
+       $total = q("SELECT count(*) as total FROM `user` where 1");
+       if(count($total)) {
+               $a->set_pager_total($total[0]['total']);
+               $a->set_pager_itemspage(100);
+       }
+
        $users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro` , `lastitem`.`changed` AS `lastitem_date`
                                FROM (
                                        SELECT `item`.`changed` , `item`.`uid`
@@ -396,8 +403,12 @@ function admin_page_users(&$a){
                                WHERE `user`.`verified` =1
                                AND `contact`.`self` =1
                                AND `lastitem`.`uid` = `user`.`uid`
-                               ORDER BY `contact`.`name`
-                               ");
+                               ORDER BY `contact`.`name` LIMIT %d, %d
+                               ",
+                               intval($a->pager['start']),
+                               intval($a->pager['itemspage'])
+
+                               );
                                        
        function _setup_users($e){
                $accounts = Array(
@@ -415,7 +426,7 @@ function admin_page_users(&$a){
        $users = array_map("_setup_users", $users);
        
        $t = get_markup_template("admin_users.tpl");
-       return replace_macros($t, array(
+       $o = replace_macros($t, array(
                // strings //
                '$title' => t('Administration'),
                '$page' => t('Users'),
@@ -443,7 +454,8 @@ function admin_page_users(&$a){
                '$pending' => $pending,
                '$users' => $users,
        ));
-       
+       $o .= paginate($a);
+       return $o;
 }