Adding a "User waiting for permanent deletion" table in admin page

This commit is contained in:
Zered 2013-08-05 06:08:33 +02:00
parent 1285cb2828
commit 82972be85e
2 changed files with 49 additions and 9 deletions

View File

@ -771,19 +771,35 @@ function admin_page_users(&$a){
$e['login_date'] = relative_date($e['login_date']); $e['login_date'] = relative_date($e['login_date']);
$e['lastitem_date'] = relative_date($e['lastitem_date']); $e['lastitem_date'] = relative_date($e['lastitem_date']);
$e['is_admin'] = ($e['email'] === $a->config['admin_email']); $e['is_admin'] = ($e['email'] === $a->config['admin_email']);
$e['deleted'] = ($e['account_removed']?relative_date($e['account_expires_on']):False);
return $e; return $e;
} }
$users = array_map("_setup_users", $users); $users = array_map("_setup_users", $users);
// Get rid of dashes in key names, Smarty3 can't handle them // Get rid of dashes in key names, Smarty3 can't handle them
foreach($users as $key => $user) { // and extracting deleted users
$new_user = array();
foreach($user as $k => $v) { $tmp_users = Array();
$deleted = Array();
while(count($users)) {
$new_user = Array();
foreach( array_pop($users) as $k => $v) {
$k = str_replace('-','_',$k); $k = str_replace('-','_',$k);
$new_user[$k] = $v; $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"); $t = get_markup_template("admin_users.tpl");
@ -794,6 +810,7 @@ function admin_page_users(&$a){
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$select_all' => t('select all'), '$select_all' => t('select all'),
'$h_pending' => t('User registrations waiting for confirm'), '$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') ), '$th_pending' => array( t('Request date'), t('Name'), t('Email') ),
'$no_pending' => t('No registrations.'), '$no_pending' => t('No registrations.'),
'$approve' => t('Approve'), '$approve' => t('Approve'),
@ -806,6 +823,7 @@ function admin_page_users(&$a){
'$h_users' => t('Users'), '$h_users' => t('Users'),
'$h_newuser' => t('New User'), '$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') ), '$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?'), '$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), '$baseurl' => $a->get_baseurl(true),
'$pending' => $pending, '$pending' => $pending,
'deleted' => $deleted,
'$users' => $users, '$users' => $users,
'$newusername' => array('new_user_name', t("Name"), '', t("Name of the new user.")), '$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.")), '$newusernickname' => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")),

View File

@ -52,9 +52,6 @@
<p>{{$no_pending}}</p> <p>{{$no_pending}}</p>
{{/if}} {{/if}}
<h3>{{$h_users}}</h3> <h3>{{$h_users}}</h3>
{{if $users}} {{if $users}}
<table id='users'> <table id='users'>
@ -69,7 +66,7 @@
<tbody> <tbody>
{{foreach $users as $u}} {{foreach $users as $u}}
<tr> <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='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
<td class='email'>{{$u.email}}</td> <td class='email'>{{$u.email}}</td>
<td class='register_date'>{{$u.register_date}}</td> <td class='register_date'>{{$u.register_date}}</td>
@ -100,6 +97,30 @@
NO USERS?!? NO USERS?!?
{{/if}} {{/if}}
</form> </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> <h3>{{$h_newuser}}</h3>
<form action="{{$baseurl}}/admin/users" method="post"> <form action="{{$baseurl}}/admin/users" method="post">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>