1 | <?php |
||
2 | |||
3 | $user = elgg_get_page_owner_entity(); |
||
4 | |||
5 | $log = system_log_get_log($user->guid, 'login', '', 'user', '', 20); |
||
6 | if (empty($log)) { |
||
7 | return; |
||
8 | } |
||
9 | $body = '<table class="elgg-table">'; |
||
10 | $body .= '<thead><tr>'; |
||
11 | $body .= '<th>' . elgg_echo('usersettings:statistics:login_history:date') . '</th><th>' . elgg_echo('usersettings:statistics:login_history:ip') . '</th>'; |
||
12 | $body .= '</tr></thead>'; |
||
13 | $body .= '<tbody>'; |
||
14 | |||
15 | foreach ($log as $entry) { |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
16 | if ($entry->ip_address) { |
||
17 | $ip_address = $entry->ip_address; |
||
18 | } else { |
||
19 | $ip_address = elgg_echo('unknown'); |
||
20 | } |
||
21 | |||
22 | $time = date(elgg_echo('friendlytime:date_format'), $entry->time_created); |
||
23 | |||
24 | $body .= "<tr><td>{$time}</td><td>{$ip_address}</td></tr>"; |
||
25 | } |
||
26 | |||
27 | $body .= '</tbody></table>'; |
||
28 | |||
29 | echo elgg_view_module('info', elgg_echo('usersettings:statistics:login_history'), $body); |
||
30 |