Elgg  Version 6.0
email.php
Go to the documentation of this file.
1 <?php
9 if (!$user instanceof ElggUser) {
10  return;
11 }
12 
13 $title = elgg_echo('email:settings');
14 
15 $content = '';
16 if (elgg_get_config('security_email_require_password') && ($user->getGUID() === elgg_get_logged_in_user_guid())) {
17  // user needs to provide current password in order to be able to change his/her email address
19  '#type' => 'password',
20  '#label' => elgg_echo('email:address:password'),
21  '#help' => elgg_echo('email:address:password:help'),
22  'name' => 'email_password',
23  'autocomplete' => 'current-password',
24  ]);
25 }
26 
28 if (elgg_get_config('security_email_require_confirmation') && isset($user->new_email)) {
29  $email_help = elgg_echo('email:address:help:confirm', [$user->new_email]);
30 }
31 
33  '#type' => 'email',
34  '#label' => elgg_echo('email:address:label'),
35  '#help' => $email_help,
36  'name' => 'email',
37  'value' => $user->email,
38 ]);
39 
40 if ($user->isAdmin()) {
41  // check is unvalidated e-mail notifications are sent
42  if ((bool) elgg_get_config('require_admin_validation') && !empty(elgg_get_config('admin_validation_notification'))) {
43  $user_setting = $user->admin_validation_notification;
44 
46  '#type' => 'checkbox',
47  '#label' => elgg_echo('account:email:admin:validation_notification'),
48  '#help' => elgg_echo('account:email:admin:validation_notification:help'),
49  'name' => 'admin_validation_notification',
50  'value' => 1,
51  'checked' => isset($user_setting) ? (bool) $user_setting : true,
52  'switch' => true,
53  ]);
54  }
55 }
56 
57 echo elgg_view_module('info', $title, $content);
if(!$user instanceof ElggUser) $title
Definition: email.php:13
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:919
$vars['class']
Elgg email input Displays an email input field.
Definition: email.php:9
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
$content
Definition: email.php:15
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
if(elgg_get_config('security_email_require_password')&&($user->getGUID()===elgg_get_logged_in_user_guid())) $email_help
Definition: email.php:27
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
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:23
$user
Provide a way of setting your email.
Definition: email.php:8
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:34