Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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 
26 echo elgg_view_input('text', [
27  'name' => 'name',
28  'value' => $name,
29  'label' => elgg_echo('name'),
30  'required' => true,
31 ]);
32 
33 echo elgg_view_input('text', [
34  'name' => 'username',
35  'value' => $username,
36  'label' => elgg_echo('username'),
37  'required' => true,
38 ]);
39 
40 echo elgg_view_input('email', [
41  'name' => 'email',
42  'value' => $email,
43  'label' => elgg_echo('email'),
44  'required' => true,
45 ]);
46 
47 echo elgg_view_input('checkbox', array(
48  'name' => 'autogen_password',
49  'value' => 1,
50  'default' => false,
51  'label' => elgg_echo('autogen_password_option'),
52  'checked' => (bool) $autogen_password,
53 ));
54 
55 echo elgg_view_input('password', [
56  'name' => 'password',
57  'value' => $password,
58  'label' => elgg_echo('password'),
59  'required' => true,
60 ]);
61 
62 echo elgg_view_input('password', [
63  'name' => 'password2',
64  'value' => $password2,
65  'label' => elgg_echo('passwordagain'),
66  'required' => true,
67 ]);
68 
69 echo elgg_view_input('checkbox', array(
70  'name' => 'admin',
71  'value' => 1,
72  'default' => false,
73  'label' => elgg_echo('admin_option'),
74  'checked' => $admin,
75 ));
76 
77 echo elgg_view_input('submit', [
78  'value' => elgg_echo('register'),
79  'field_class' => 'elgg-foot',
80 ]);
$name
Definition: useradd.php:16
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_view_input($input_type, array $vars=array())
Renders a form field.
Definition: views.php:1332
elgg_require_js($name)
Request that Elgg load an AMD module onto the page.
Definition: elgglib.php:220
$password2
Definition: useradd.php:14
$email
Definition: useradd.php:15
if(is_array($admin)) $autogen_password
Definition: useradd.php:27
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:1310
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