Skip Navigation

[Resolved] Optionally Change Password, when editing Profile

This thread is resolved. Here is a description of the problem and solution.

Problem: I added password and repeat password fields to my CRED edit User form, but I would like for them to be optional.

Solution: There are two workarounds for this issue now:
1. Add a generic checkbox field and use a CRED conditional to show or hide both password fields based on the checkbox status.

2. Use two generic fields instead of the standard CRED fields for password and repeat password. Use the same field names, but make them optional:

      [cred_generic_field field='user_pass' type='textfield' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]

[cred_generic_field field='user_pass2' type='textfield' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]

Relevant Documentation: https://toolset.com/documentation/user-guides/cred-user-forms/

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by theW 6 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#605231
CRED.png
Edit.png

Tell us what you are trying to do?
Let logged in users have the option, to change their password when editing their Profile, if they wanted to.

Is there any documentation that you are following?
Yes:
https://toolset.com/documentation/user-guides/cred-training-course/part-8-building-forms-for-editing-user-profile/

Is there a similar example that we can see?
The "Clean Login" Plugin:
https://wordpress.org/plugins/clean-login/
When using their: " [clean-login-edit] " short-code

I tried the following code:

<p><b>CHANGE PASSWORD</b><br>
If you'd like to change your password type a new one.<br> 
Otherwise leave the bellow blank.<p>  
  
<div class="row">
	<div class="col-sm-6">
      
      <div class="form-group">
		<label>Password</label>
		[cred_field field='user_pass' post='user' value='' urlparam='' class='form-control' output='bootstrap']
	</div>
  
  </div>
	<div class="col-sm-6">
      
      <div class="form-group">
		<label>Confirm Password</label>
		[cred_field field='user_pass2' post='user' value='' urlparam='' class='form-control' output='bootstrap']
	</div>
  
  </div>
</div>

But it forces a change of password when updating.
How can I make this optional?

What is the link to your site?
hidden link

#605495

Hi, as a workaround you can replace the password fields with generic fields that use the same field names, and set them to be not required:

<p><b>CHANGE PASSWORD</b><br>
If you'd like to change your password type a new one.<br> 
Otherwise leave the bellow blank.<p>  
   
<div class="row">
    <div class="col-sm-6">
       
      <div class="form-group">
        <label>Password</label>
       [cred_generic_field field='user_pass' type='textfield' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]
    </div>
   
  </div>
    <div class="col-sm-6">
       
      <div class="form-group">
        <label>Confirm Password</label>
        [cred_generic_field field='user_pass2' type='textfield' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]
    </div>
   
  </div>
</div>

I'm escalating this issue to my 2nd tier support team, since it seems like this should not be necessary. I'll update you here when I have some additional information to share.

#605519

My 2nd tier support team has offered another option to resolve this.
- Use the standard CRED fields for password and repeat password
- Create a generic checkbox field that says "edit password"
- Use CRED conditionals to show the password fields if the checkbox is checked

Please let me know if either of these workarounds works for you.

#605637

Thank you so much for both solutions Cox.
I'll try to implement both of your suggestions and let you know how it goes.