]> git.mxchange.org Git - friendica.git/commitdiff
Adding a "User waiting for permanent deletion" table in admin page
authorZered <zered.free@free.fr>
Mon, 5 Aug 2013 04:08:33 +0000 (06:08 +0200)
committerZered <zered.free@free.fr>
Mon, 5 Aug 2013 04:08:33 +0000 (06:08 +0200)
mod/admin.php
view/templates/admin_users.tpl

index 1042bbd502a929d45c579ff718abe2c0347a1e19..4539e4192b8f6f5a436a7c2f1ffe7a3baf4d70c6 100644 (file)
@@ -655,7 +655,7 @@ function admin_page_users_post(&$a){
                    info( t('Registration successful. Email send to user').EOL ); 
       } 
   }
-
+       
        if (x($_POST,'page_users_block')){
                foreach($users as $uid){
                        q("UPDATE `user` SET `blocked`=1-`blocked` WHERE `uid`=%s",
@@ -771,19 +771,35 @@ function admin_page_users(&$a){
                $e['login_date'] = relative_date($e['login_date']);
                $e['lastitem_date'] = relative_date($e['lastitem_date']);
         $e['is_admin'] = ($e['email'] === $a->config['admin_email']);
+        $e['deleted'] = ($e['account_removed']?relative_date($e['account_expires_on']):False);
                return $e;
        }
        $users = array_map("_setup_users", $users);
        
        
        // Get rid of dashes in key names, Smarty3 can't handle them
-       foreach($users as $key => $user) {
-               $new_user = array();
-               foreach($user as $k => $v) {
+       // and extracting deleted users
+       
+       $tmp_users = Array();
+       $deleted = Array();
+       
+       while(count($users)) {
+               $new_user = Array();
+               foreach( array_pop($users) as $k => $v) {
                        $k = str_replace('-','_',$k);
                        $new_user[$k] = $v;
                }
-               $users[$key] = $new_user;
+               if($new_user['deleted']) {
+                       array_push($deleted, $new_user);
+               }
+               else {
+                       array_push($tmp_users, $new_user);
+               }
+       }
+       //Reversing the two array, and moving $tmp_users to $users
+       array_reverse($deleted);
+       while(count($tmp_users)) {
+               array_push($users, array_pop($tmp_users));
        }
 
        $t = get_markup_template("admin_users.tpl");
@@ -794,6 +810,7 @@ function admin_page_users(&$a){
                '$submit' => t('Submit'),
                '$select_all' => t('select all'),
                '$h_pending' => t('User registrations waiting for confirm'),
+               '$h_deleted' => t('User waiting for permanent deletion'),
                '$th_pending' => array( t('Request date'), t('Name'), t('Email') ),
                '$no_pending' =>  t('No registrations.'),
                '$approve' => t('Approve'),
@@ -806,6 +823,7 @@ function admin_page_users(&$a){
                
                '$h_users' => t('Users'),
                '$h_newuser' => t('New User'),
+               '$th_deleted' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since') ),
                '$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'),  t('Account') ),
 
                '$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
@@ -817,6 +835,7 @@ function admin_page_users(&$a){
                '$baseurl' => $a->get_baseurl(true),
 
                '$pending' => $pending,
+               'deleted' => $deleted,
                '$users' => $users,
                '$newusername'  => array('new_user_name', t("Name"), '', t("Name of the new user.")), 
     '$newusernickname'  => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")), 
index 67ad40768f58d15878d2e942f4ac6b08097d76a1..f8d183d1ac58c9565224cd3d384186668cf6ac5e 100644 (file)
@@ -52,9 +52,6 @@
                        <p>{{$no_pending}}</p>
                {{/if}}
        
-       
-               
-       
                <h3>{{$h_users}}</h3>
                {{if $users}}
                        <table id='users'>
@@ -69,7 +66,7 @@
                                <tbody>
                                {{foreach $users as $u}}
                                        <tr>
-                                               <td><img src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
+                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
                                                <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
                                                <td class='email'>{{$u.email}}</td>
                                                <td class='register_date'>{{$u.register_date}}</td>
                        NO USERS?!?
                {{/if}}
        </form>
+       {{if $deleted}}
+               <h3>{{$h_deleted}}</h3>
+                       <table id='deleted'>
+                               <thead>
+                               <tr>
+                                       <th></th>
+                                       {{foreach $th_deleted as $th}}<th>{{$th}}</th>{{/foreach}}
+                               </tr>
+                               </thead>
+                               <tbody>
+                               {{foreach $deleted as $u}}
+                                       <tr>
+                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
+                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
+                                               <td class='email'>{{$u.email}}</td>
+                                               <td class='register_date'>{{$u.register_date}}</td>
+                                               <td class='login_date'>{{$u.login_date}}</td>
+                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
+                                               <td class='login_date'>{{$u.deleted}}</td>
+                                       </tr>
+                               {{/foreach}}
+                               </tbody>
+                       </table>
+               {{/if}}
   <h3>{{$h_newuser}}</h3> 
   <form action="{{$baseurl}}/admin/users" method="post"> 
   <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>