Elgg  Version 6.1
username.php
Go to the documentation of this file.
1 <?php
8 if (!elgg_is_admin_logged_in() && !elgg_get_config('can_change_username')) {
9  // only admins are allowed to change the username
10  return;
11 }
12 
14 if (!$user instanceof \ElggUser) {
15  return;
16 }
17 
18 echo elgg_view_field([
19  '#type' => 'text',
20  '#label' => elgg_echo('username'),
21  '#help' => elgg_echo('user:username:help'),
22  'name' => 'username',
23  'value' => $user->username,
24 ]);
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:52
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
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
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:23
if(!elgg_is_admin_logged_in()&&!elgg_get_config('can_change_username')) $user
Provide a way of changing the username of a user.
Definition: username.php:13
$vars
Definition: theme.php:5