Elgg  Version 6.0
online.php
Go to the documentation of this file.
1 <?php
8 $user = elgg_extract('entity', $vars, elgg_get_page_owner_entity()); // page owner for BC reasons
9 if (!$user instanceof \ElggUser) {
10  return;
11 }
12 
13 $time_created = elgg_view('output/date', [
14  'value' => $user->time_created,
15  'format' => DATE_RFC2822,
16 ]);
17 $last_login = elgg_view('output/date', [
18  'value' => $user->last_login,
19  'format' => DATE_RFC2822,
20 ]);
21 
22 if ($user->guid === elgg_get_logged_in_user_guid()) {
23  $title = elgg_echo('usersettings:statistics:yourdetails');
24 } else {
25  $title = elgg_echo('usersettings:statistics:details:user', [$user->getDisplayName()]);
26 }
27 
28 $table = elgg_format_element('tr', [], implode(PHP_EOL, [
29  elgg_format_element('td', [], elgg_echo('usersettings:statistics:label:name')),
30  elgg_format_element('td', [], $user->getDisplayName()),
31 ]));
32 $table .= elgg_format_element('tr', [], implode(PHP_EOL, [
33  elgg_format_element('td', [], elgg_echo('usersettings:statistics:label:email')),
34  elgg_format_element('td', [], $user->email),
35 ]));
36 $table .= elgg_format_element('tr', [], implode(PHP_EOL, [
37  elgg_format_element('td', [], elgg_echo('usersettings:statistics:label:membersince')),
39 ]));
40 $table .= elgg_format_element('tr', [], implode(PHP_EOL, [
41  elgg_format_element('td', [], elgg_echo('usersettings:statistics:label:lastlogin')),
43 ]));
44 $table = elgg_format_element('table', ['class' => 'elgg-table-alt'], $table);
45 
46 echo elgg_view_module('info', $title, $table);
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:919
$last_login
Definition: online.php:17
$title
Definition: generic.php:50
if(!$user instanceof\ElggUser) $time_created
Definition: online.php:13
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$table
Definition: online.php:28
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:23
$user
Statistics about this user.
Definition: online.php:8
$vars
Definition: theme.php:5
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:34