Elgg  Version 4.3
login_dropdown.php
Go to the documentation of this file.
1 <?php
6 if (elgg_is_logged_in()) {
7  return true;
8 }
9 
10 $body = elgg_view_form('login', [
11  'ajax' => true,
12 ], [
13  'returntoreferer' => true,
14 ]);
15 
16 $result = elgg_view('output/url', [
17  'href' => elgg_get_login_url([], '#login-dropdown-box'),
18  'class' => 'elgg-popup',
19  'text' => elgg_echo('login'),
20  'data-position' => json_encode([
21  'my' => 'right top',
22  'at' => 'right bottom',
23  ]),
24 ]);
25 
26 $result .= elgg_view_module('dropdown', '', $body, ['id' => 'login-dropdown-box']);
27 
28 echo elgg_format_element('div', ['id' => 'login-dropdown'], $result);
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
Definition: sessions.php:43
if(elgg_is_logged_in()) $body
Elgg drop-down login form.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
elgg_view_form($action, $form_vars=[], $body_vars=[])
Definition: views.php:1064
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:135
elgg_view_module($type, $title, $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:944
$result
elgg echo
Translates a string.
Definition: deprecated.js:530
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179
elgg_get_login_url(array $query=[], $fragment= '')
Returns site&#39;s login URL Triggers a &#39;login_url&#39;, &#39;site&#39; plugin hook that can be used by plugins to al...
Definition: users.php:185