Elgg  Version 3.0
useradd.php
Go to the documentation of this file.
1 <?php
2 
10 elgg_require_js('forms/useradd');
11 
12 if (elgg_is_sticky_form('useradd')) {
13  $values = elgg_get_sticky_values('useradd');
14  elgg_clear_sticky_form('useradd');
15 } else {
16  $values = [];
17 }
18 
20 $name = elgg_extract('name', $values);
21 $username = elgg_extract('username', $values);
22 $email = elgg_extract('email', $values);
23 $admin = elgg_extract('admin', $values);
24 $autogen_password = elgg_extract('autogen_password', $values);
25 
27  '#type' => 'text',
28  'name' => 'name',
29  'value' => $name,
30  '#label' => elgg_echo('name'),
31  'required' => true,
32 ]);
33 
35  '#type' => 'text',
36  'name' => 'username',
37  'value' => $username,
38  '#label' => elgg_echo('username'),
39  'required' => true,
40 ]);
41 
43  '#type' => 'email',
44  'name' => 'email',
45  'value' => $email,
46  '#label' => elgg_echo('email'),
47  'required' => true,
48 ]);
49 
51  '#type' => 'checkbox',
52  'name' => 'autogen_password',
53  'value' => 1,
54  'default' => false,
55  'label' => elgg_echo('autogen_password_option'),
56  'checked' => (bool) $autogen_password,
57 ]);
58 
60  '#type' => 'password',
61  'name' => 'password',
62  'value' => $password,
63  '#label' => elgg_echo('password'),
64  'required' => true,
65 ]);
66 
68  '#type' => 'password',
69  'name' => 'password2',
70  'value' => $password2,
71  '#label' => elgg_echo('passwordagain'),
72  'required' => true,
73 ]);
74 
76  '#type' => 'checkbox',
77  'name' => 'admin',
78  'value' => 1,
79  'default' => false,
80  'label' => elgg_echo('admin_option'),
81  'checked' => $admin,
82 ]);
83 
85  '#type' => 'submit',
86  'value' => elgg_echo('register'),
87 ]);
88 
$name
Definition: useradd.php:13
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1395
$admin
Definition: useradd.php:19
$username
Definition: useradd.php:9
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_set_form_footer($footer= '')
Sets form footer and defers its rendering until the form view and extensions have been rendered...
Definition: views.php:1331
elgg_require_js($name)
Request that Elgg load an AMD module onto the page.
Definition: elgglib.php:168
$password2
Definition: useradd.php:11
$email
Definition: useradd.php:12
$autogen_password
Definition: useradd.php:22
elgg echo
Translates a string.
Definition: languages.js:43
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1131
elgg_is_sticky_form($form_name)
Does form submission data exist for this form?
Definition: input.php:148
elgg_clear_sticky_form($form_name)
Remove form submission data from the session.
Definition: input.php:136
elgg_get_sticky_values($form_name, $filter_result=true)
Get all submission data cached for a form.
Definition: input.php:178
$password
Definition: useradd.php:10
$footer
Definition: useradd.php:84