Elgg  Version 4.3
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 ]);
$entity
Render the last login timestamp.
Definition: last_login.php:11
if(empty($value)) $format
Definition: last_login.php:22
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
if($format=== 'friendly')
Definition: last_login.php:24
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
if(!$entity instanceof\ElggUser) $value
Definition: last_login.php:16
elgg echo
Translates a string.
Definition: deprecated.js:530
$vars['head']
Definition: html.php:24
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179