Elgg  Version 5.0
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 }
14 if (!$user instanceof ElggUser) {
15  return;
16 }
19  '#type' => 'text',
20  '#help' => elgg_echo('user:username:help'),
21  'name' => 'username',
22  'value' => $user->username,
23 ]);
25 echo elgg_view_module('info', elgg_echo('username'), $body);
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:940
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1133
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:52
if(!$user instanceof ElggUser) $body
Definition: username.php:18
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:254
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
Definition: html.php:24