Elgg  Version 6.1
last_login.php
Go to the documentation of this file.
1 <?php
12 if (!$entity instanceof \ElggUser) {
13  return;
14 }
15 
16 $value = (int) $entity->last_login;
17 if (empty($value)) {
18  echo elgg_echo('never');
19  return;
20 }
21 
22 $format = elgg_extract('format', $vars, DATE_RFC2822);
23 
24 if ($format === 'friendly') {
25  echo elgg_view('output/friendlytime', [
26  'time' => $value,
27  ]);
28  return;
29 }
30 
31 echo elgg_view('output/date', [
32  'value' => $value,
33  'format' => $format,
34 ]);
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$entity
Render the last login timestamp.
Definition: last_login.php:11
if(empty($value)) $format
Definition: last_login.php:22
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:256
if($format=== 'friendly')
Definition: last_login.php:24
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
if(!$entity instanceof\ElggUser) $value
Definition: last_login.php:16
$vars
Definition: theme.php:5