Elgg  Version 2.3
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 = array();
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 
50 echo elgg_view_field(array(
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 
75 echo elgg_view_field(array(
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  '#class' => 'elgg-foot',
88 ]);
$name
Definition: useradd.php:16
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1424
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$admin
Definition: useradd.php:22
$username
Definition: useradd.php:12
elgg_require_js($name)
Request that Elgg load an AMD module onto the page.
Definition: elgglib.php:232
$password2
Definition: useradd.php:14
$email
Definition: useradd.php:15
if(is_array($admin)) $autogen_password
Definition: useradd.php:27
elgg echo
Translates a string.
Definition: languages.js:48
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:1375
elgg_is_sticky_form($form_name)
Does form submission data exist for this form?
Definition: input.php:131
elgg_clear_sticky_form($form_name)
Remove form submission data from the session.
Definition: input.php:119
elgg_get_sticky_values($form_name, $filter_result=true)
Get all submission data cached for a form.
Definition: input.php:161
$password
Definition: useradd.php:13