We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

EE2 Standalone Update Username & Password Form

Development and Programming

Dave O'Brien's avatar
Dave O'Brien
6 posts
15 years ago
Dave O'Brien's avatar Dave O'Brien

Hello,

Does anyone know how to add an update username and password form to a page within the site theme? I’ve incorporated a registration form in successfully as detailed in this page: http://expressionengine.com/wiki/EE2_Standalone_Registration_Form

I’ve tried using the following code based on the registration form wiki:

<?php 
$this->EE =& get_instance();
$action_id = $this->EE->functions->fetch_action_id('Member', 'update_un_pw');

print $action_id;
?> 

<form id="register_member_form" method="post" action="index.php"> 
      <input type="hidden" name="XID" value={XID_HASH} /> 
      <input type="hidden" name="ACT" value="<?php echo $action_id; ?>" />
      <input type="hidden" name="RET" value="user/update-username-password-success" /> 
      <input type="hidden" name="site_id" value="1" /> 
        <div class="form-item form-item-textfield form-item-required">
            <label for="username">Username</label>{required}<input type="text" name="username" value="{username}" id="username" />                                
        </div>
        <div class="form-item form-item-textfield form-item-required">
            <label for="screen_name">Screen Name</label>{required}<input type="text" name="screen_name" value="{screen_name}" id="screen_name" />                                
        </div>
        <div class="form-item form-item-textfield form-item-required">
            <label for="password">New Password</label>{required}<input type="password" name="password" value="" id="password" />                                
        </div>
        <div class="form-item form-item-textfield form-item-required">
            <label for="password_confirm">...and again</label>{required}<input type="password" name="password_confirm" value="" id="password_confirm" />                                
        </div>
        <div class="form-item form-item-textfield form-item-required">
            <label for="current_password">Existing Password</label>{required}<input type="password" name="current_password" value="" id="current_password" />                                
        </div>
        <div class="form-item form-item-submit">
            <button type="submit" name="submit" value="Send" id="submit" class="ir">Submit</button>
        </div>
</form>

On submission, it throws an error - You must submit all fields

I’ve tried this with just providing Username, Screen Name & Current Password, as well as Username, Screen Name, New Password, New Password Confirm & Current Passwor.

Thanks in advance

Dave

Moved to Development and Programming by Moderator

       
Greg Aker's avatar
Greg Aker
6,022 posts
15 years ago
Greg Aker's avatar Greg Aker

Greetings Dave & Welcome to the forums!

The form needs the following fields: username, new_username, password, and new_password.

-greg

       
Dave O'Brien's avatar
Dave O'Brien
6 posts
15 years ago
Dave O'Brien's avatar Dave O'Brien

Hi Greg,

Thanks for the reply - that makes sense. We actually went an purchased Solspace’s User module which did the trick. I’ll have another go when I get some time on a clean install.

Dave

  • PS, am loving EE! I’ve spent the last month using it and it’s awesome to use. I came from the Drupal background and used to preach about it until the cows came home, but I found theming the biggest problem with Drupal. EE has given me control over the front end again! End Rant 😊
       
Greg Aker's avatar
Greg Aker
6,022 posts
15 years ago
Greg Aker's avatar Greg Aker

Woot! I’m glad you’re up and going. Don’t be a stranger on the forums if you run into a tight spot 😊

-greg

       
solist's avatar
solist
16 posts
14 years ago
solist's avatar solist

My 2 cents:

I had to comment out this piece of code to get only one or the other (username or pwd changed)

file:mod.member_settings.php

I do not encourage to modify the source code as any further EE upgrade down the road will become complicated to maintain.

Comment out the following lines as they force the users to change their Username and PWD (not one OR the other) (line: 2140)

/*  
  if ( ! isset($_POST['new_username']) AND ! isset($_POST['new_password']))
  {
   $missing = TRUE;
  }

  if ((isset($_POST['new_username']) AND $_POST['new_username'] == '') OR (isset($_POST['new_password']) AND $_POST['new_password'] == ''))
  {
   $missing = TRUE;
  }
*/

And correct this piece of Code (line: 2167)

//   return $this->EE->output->show_user_error('submission', implode(', ', $this->auth->errors));
      return $this->EE->output->show_user_error('submission', implode(', ', $this-[b]>EE[/b]->auth->errors));
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.