Elgg  Version 6.1
index.php
Go to the documentation of this file.
1 <?php
2 
3 if (elgg_is_logged_in()) {
4  $title = elgg_echo('welcome:user', [elgg_get_logged_in_user_entity()->getDisplayName()]);
5  $content = elgg_echo('index:content');
6 } elseif (elgg_get_config('allow_registration')) {
7  $title = elgg_echo('register');
8  $content = elgg_view_form('register', [
9  'ajax' => true,
10  'sticky_enabled' => true,
11  'sticky_ignored_fields' => [
12  'password',
13  'password2',
14  ],
15  ]);
16 } else {
17  $title = elgg_echo('login');
18  $content = elgg_view_form('login', ['ajax' => true]);
19 }
20 
21 echo elgg_view_page('', [
22  'title' => $title,
23  'content' => $content,
24  'filter_id' => 'index',
25 ]);
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
Definition: sessions.php:43
elgg_view_form(string $action, array $form_vars=[], array $body_vars=[])
Definition: views.php:1033
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
$title
Definition: generic.php:50
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof\ElggRelationship) elseif(is_callable([$item, 'getType']))
Definition: item.php:48
elgg_view_page(string $title, string|array $body, string $page_shell= 'default', array $vars=[])
Assembles and outputs a full page.
Definition: views.php:235
$content
Definition: index.php:18
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:24