]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #3233 registration form should be sticky too
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 2 Apr 2011 01:48:20 +0000 (01:48 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 2 Apr 2011 01:48:20 +0000 (01:48 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8902 36083f99-b078-4883-b0ff-0f9b5a30f544

actions/register.php
views/default/forms/register.php

index 33ee19aee89737c454cd7843f9d2f0485ac5d6e5..360b7cb4b30aa6ed2f4c512d4d59aebb85b253ba 100644 (file)
@@ -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
index faffb285af03c485e76b909451537d1bb851cb10..6f35a3ea3f2cedceca835ca4ec10e7ae0356a979 100644 (file)
@@ -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']));