Elgg  Version 3.0
register.php
Go to the documentation of this file.
1 <?php
9 if (elgg_is_sticky_form('register')) {
10  $values = elgg_get_sticky_values('register');
11 
12  // Add the sticky values to $vars so views extending
13  // register/extend also get access to them.
14  $vars = array_merge($vars, $values);
15 
16  elgg_clear_sticky_form('register');
17 } else {
18  $values = [];
19 }
20 
22 $username = elgg_extract('username', $values, get_input('u'));
23 $email = elgg_extract('email', $values, get_input('e'));
24 $name = elgg_extract('name', $values, get_input('n'));
25 
27  [
28  '#type' => 'hidden',
29  'name' => 'friend_guid',
30  'value' => elgg_extract('friend_guid', $vars),
31  ],
32  [
33  '#type' => 'hidden',
34  'name' => 'invitecode',
35  'value' => elgg_extract('invitecode', $vars),
36  ],
37  [
38  '#type' => 'text',
39  '#label' => elgg_echo('name'),
40  '#class' => 'mtm',
41  'name' => 'name',
42  'value' => $name,
43  'autofocus' => true,
44  'required' => true,
45  ],
46  [
47  '#type' => 'email',
48  '#label' => elgg_echo('email'),
49  'name' => 'email',
50  'value' => $email,
51  'required' => true,
52  ],
53  [
54  '#type' => 'text',
55  '#label' => elgg_echo('username'),
56  'name' => 'username',
57  'value' => $username,
58  'required' => true,
59  ],
60  [
61  '#type' => 'password',
62  '#label' => elgg_echo('password'),
63  'name' => 'password',
64  'value' => $password,
65  'required' => true,
66  ],
67  [
68  '#type' => 'password',
69  '#label' => elgg_echo('passwordagain'),
70  'name' => 'password2',
71  'value' => $password2,
72  'required' => true,
73  ],
74 ];
75 
76 foreach ($fields as $field) {
77  echo elgg_view_field($field);
78 }
79 
80 // view to extend to add more fields to the registration form
81 echo elgg_view('register/extend', $vars);
82 
83 // Add captcha hook
84 echo elgg_view('input/captcha', $vars);
85 
87  '#type' => 'submit',
88  'value' => elgg_echo('register'),
89 ]);
90 
$password2
Definition: register.php:17
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1395
$fields
Definition: register.php:26
$name
Definition: register.php:19
$email
Definition: register.php:18
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
$password
Definition: register.php:16
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$footer
Definition: register.php:86
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
if(!elgg_get_config('allow_registration')) $username
Definition: register.php:15
if(elgg_extract('required', $vars)) $field
Definition: field.php:34
$vars['type']
Definition: save.php:11
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_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246
elgg_get_sticky_values($form_name, $filter_result=true)
Get all submission data cached for a form.
Definition: input.php:178