re-added last item date in admin user page. relative_date return 'never' if null is passed
This commit is contained in:
parent
baead9f4c8
commit
f4a1820110
3 changed files with 16 additions and 7 deletions
|
@ -177,7 +177,7 @@ function relative_date($posted_date) {
|
||||||
|
|
||||||
$abs = strtotime($localtime);
|
$abs = strtotime($localtime);
|
||||||
|
|
||||||
if ($posted_date === '0000-00-00 00:00:00' || $abs === False) {
|
if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) {
|
||||||
return t('never');
|
return t('never');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,11 +406,18 @@ function admin_page_users(&$a){
|
||||||
$a->set_pager_itemspage(100);
|
$a->set_pager_itemspage(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`
|
$users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`
|
||||||
FROM `user`
|
FROM
|
||||||
LEFT JOIN `contact` ON `user`.`uid` = `contact`.`uid`
|
(SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
|
||||||
WHERE `user`.`verified` =1
|
FROM `item`
|
||||||
AND `contact`.`self` =1
|
WHERE `item`.`type` = 'wall'
|
||||||
|
GROUP BY `item`.`uid`) AS `lastitem`
|
||||||
|
RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`,
|
||||||
|
`contact`
|
||||||
|
WHERE
|
||||||
|
`user`.`uid` = `contact`.`uid`
|
||||||
|
AND `user`.`verified` =1
|
||||||
|
AND `contact`.`self` =1
|
||||||
ORDER BY `contact`.`name` LIMIT %d, %d
|
ORDER BY `contact`.`name` LIMIT %d, %d
|
||||||
",
|
",
|
||||||
intval($a->pager['start']),
|
intval($a->pager['start']),
|
||||||
|
@ -427,6 +434,7 @@ function admin_page_users(&$a){
|
||||||
$e['page-flags'] = $accounts[$e['page-flags']];
|
$e['page-flags'] = $accounts[$e['page-flags']];
|
||||||
$e['register_date'] = relative_date($e['register_date']);
|
$e['register_date'] = relative_date($e['register_date']);
|
||||||
$e['login_date'] = relative_date($e['login_date']);
|
$e['login_date'] = relative_date($e['login_date']);
|
||||||
|
$e['lastitem_date'] = relative_date($e['lastitem_date']);
|
||||||
return $e;
|
return $e;
|
||||||
}
|
}
|
||||||
$users = array_map("_setup_users", $users);
|
$users = array_map("_setup_users", $users);
|
||||||
|
@ -448,7 +456,7 @@ function admin_page_users(&$a){
|
||||||
'$unblock' => t('Unblock'),
|
'$unblock' => t('Unblock'),
|
||||||
|
|
||||||
'$h_users' => t('Users'),
|
'$h_users' => t('Users'),
|
||||||
'$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), 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?'),
|
||||||
'$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),
|
'$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<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>
|
||||||
<td class='login_date'>$u.login_date</td>
|
<td class='login_date'>$u.login_date</td>
|
||||||
|
<td class='lastitem_date'>$u.lastitem_date</td>
|
||||||
<td class='login_date'>$u.page-flags</td>
|
<td class='login_date'>$u.page-flags</td>
|
||||||
<td class="checkbox"><input type="checkbox" class="users_ckbx" id="id_user_$u.uid" name="user[]" value="$u.uid"/></td>
|
<td class="checkbox"><input type="checkbox" class="users_ckbx" id="id_user_$u.uid" name="user[]" value="$u.uid"/></td>
|
||||||
<td class="tools">
|
<td class="tools">
|
||||||
|
|
Loading…
Reference in a new issue