Elgg  Version 4.3
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 $label_name = elgg_echo('usersettings:statistics:label:name');
14 $label_email = elgg_echo('usersettings:statistics:label:email');
15 $label_member_since = elgg_echo('usersettings:statistics:label:membersince');
16 $label_last_login = elgg_echo('usersettings:statistics:label:lastlogin');
17 
18 $time_created = elgg_view('output/date', [
19  'value' => $user->time_created,
20  'format' => DATE_RFC2822,
21 ]);
22 $last_login = elgg_view('output/date', [
23  'value' => $user->last_login,
24  'format' => DATE_RFC2822,
25 ]);
26 
27 if ($user->guid === elgg_get_logged_in_user_guid()) {
28  $title = elgg_echo('usersettings:statistics:yourdetails');
29 } else {
30  $title = elgg_echo('usersettings:statistics:details:user', [$user->getDisplayName()]);
31 }
32 
33 $content = <<<__HTML
34 <table class="elgg-table-alt">
35  <tr>
36  <td class="column-one">$label_name</td>
37  <td>{$user->getDisplayName()}</td>
38  </tr>
39  <tr>
40  <td class="column-one">$label_email</td>
41  <td>{$user->email}</td>
42  </tr>
43  <tr>
44  <td class="column-one">$label_member_since</td>
45  <td>$time_created</td>
46  </tr>
47  <tr>
48  <td class="column-one">$label_last_login</td>
49  <td>$last_login</td>
50  </tr>
51 </table>
52 __HTML;
53 
$last_login
Definition: online.php:22
$title
Definition: generic.php:50
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
$label_email
Definition: online.php:14
$label_member_since
Definition: online.php:15
elgg_view_module($type, $title, $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:950
$label_last_login
Definition: online.php:16
$time_created
Definition: online.php:18
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:23
$content
Definition: online.php:33
$user
Statistics about this user.
Definition: online.php:8
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:547
elgg echo
Translates a string.
Definition: deprecated.js:530
$vars['head']
Definition: html.php:24
if(!$user instanceof ElggUser) $label_name
Definition: online.php:13
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:34