diff options
-rw-r--r-- | actions/register.php | 4 | ||||
-rw-r--r-- | views/default/forms/register.php | 64 |
2 files changed, 52 insertions, 16 deletions
diff --git a/actions/register.php b/actions/register.php index 33ee19aee..360b7cb4b 100644 --- a/actions/register.php +++ b/actions/register.php @@ -6,6 +6,8 @@ * @subpackage User.Account */ +elgg_make_sticky_form('register'); + // Get variables $username = get_input('username'); $password = get_input('password'); @@ -28,6 +30,8 @@ if (elgg_get_config('allow_registration')) { $guid = register_user($username, $password, $name, $email, false, $friend_guid, $invitecode); if ($guid) { + elgg_clear_sticky_form('register'); + $new_user = get_entity($guid); // allow plugins to respond to self registration diff --git a/views/default/forms/register.php b/views/default/forms/register.php index faffb285a..6f35a3ea3 100644 --- a/views/default/forms/register.php +++ b/views/default/forms/register.php @@ -6,6 +6,7 @@ * @subpackage Core */ +$password = $password2 = ''; $username = get_input('u'); $email = get_input('e'); $name = get_input('n'); @@ -15,31 +16,59 @@ if (elgg_is_admin_logged_in() && isset($vars['show_admin'])) { $admin_option = true; } +if (elgg_is_sticky_form('register')) { + extract(elgg_get_sticky_values('register')); + elgg_clear_sticky_form('register'); + if (is_array($admin)) { + $admin = $admin[0]; + } +} + ?> <div class="mtm"> - <label><?php echo elgg_echo('name'); ?></label> - <br /> - <?php echo elgg_view('input/text', array('name' => 'name', 'value' => $name)); ?> + <label><?php echo elgg_echo('name'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'name', + 'value' => $name, + )); + ?> </div> <div> - <label><?php echo elgg_echo('email'); ?></label> - <br /> - <?php echo elgg_view('input/text', array('name' => 'email', 'value' => $email)); ?> + <label><?php echo elgg_echo('email'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'email', + 'value' => $email, + )); + ?> </div> <div> - <label><?php echo elgg_echo('username'); ?></label> - <br /> - <?php echo elgg_view('input/text', array('name' => 'username', 'value' => $username)); ?> + <label><?php echo elgg_echo('username'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'username', + 'value' => $username, + )); + ?> </div> <div> - <label><?php echo elgg_echo('password'); ?></label> - <br /> - <?php echo elgg_view('input/password', array('name' => 'password')); ?> + <label><?php echo elgg_echo('password'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password', + 'value' => $password, + )); + ?> </div> <div> - <label><?php echo elgg_echo('passwordagain'); ?></label> - <br /> - <?php echo elgg_view('input/password', array('name' => 'password2')); ?> + <label><?php echo elgg_echo('passwordagain'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password2', + 'value' => $password2, + )); + ?> </div> <?php @@ -50,7 +79,10 @@ echo elgg_view('register/extend'); echo elgg_view('input/captcha'); if ($admin_option) { - echo elgg_view('input/checkboxes', array('name' => "admin", 'options' => array(elgg_echo('admin_option')))); + echo elgg_view('input/checkboxes', array( + 'name' => "admin", + 'options' => array(elgg_echo('admin_option')), + )); } echo elgg_view('input/hidden', array('name' => 'friend_guid', 'value' => $vars['friend_guid'])); |