Password reset thank you message

Hi,

Is there a simple way to hide the password reset form once it has been submitted so that only the confirmation message is displayed? Some users have been unsure as to whether the form submitted because it is still visible so I was wondering if there was a way I could improve the usability of this.

Thanks,

Greg

Hi Damon,

I am also using version 1.11.

Regards,

Greg

By Damon - September 22, 2016

Hi Greg,

The default code generator code for the user-password-reset.php includes an IF statement like this:

<?php if ($showForm): ?>
<form method="post" action="?">
<input type="hidden" name="userNum" value="<?php echo htmlencode(@$_REQUEST['userNum']); ?>" />
etc...

Higher up in the code, $showForm is set to false  after the form is submitted.

$showForm = false;

This hides the form. 

We also have an example of this working on the interactivetools.com site. You can go to the login here:
http://www.interactivetools.com/add-ons/login.php
Click the Forgot password? link. Then click reset link you will be emailed. Fill in your new password twice, submit and the form will be gone.

Can you try the default user-password-reset.php generated code in a separate file and test that it works for you?

Let me know.

Thanks!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Hi Damon,

Sorry for not making myself clearer but the form I am actually referring to is the one on the password request page (user-password-request.php).

When the user enters their email address then there is a success message:

"Thanks, we've emailed you instructions on resetting your password..."

Below the success message, the form still displays. I would like to be able to hide the form from here as users have sometimes thought they need to re-enter their email address (despite the success message above).

Is that possible?

Thanks,

Greg

By Damon - September 23, 2016

Hi Greg,

Yes, this is possible. Here is the steps:

Open the user-password-reset.php file in a code editor. It already has code to hide the form on submit that you can use for reference.

Open the user-password-request.php file in a code editor.

1. Wrap the form and anything else you want hidden on successful submit in an IF statement.

<?php if ($showForm): ?>
  <form action="" method="post">
    ....
    ....
  </form>
<?php endif ?>

2. Set the $showForm variable to true higher up in the page. See the other user-password-reset.php file for an example.

$showForm = true;

3. Change the $showForm variable to false to hide the form on submit success. Put this code in the same IF statement under the success text: "Thanks, we've emailed you instructions on resetting your password...."

$showForm = false;

That's it. The form will disappear after the form is successfully submitted.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Hi Damon,

Thank you for the clear instructions. I am having a slight issue with the fact that there is already an IF statement wrapped around the password request form to check that the user is not already logged in:

<?php if (!@$CURRENT_USER) ?>

<form action="?" method="post">

....

</form>
<?php endif ?>

Can you please tell me how to combine the two IF statements?

I have tried the following but it does not work (the page won't load):

<?php if ($showForm) && (!@$CURRENT_USER): ?>

<form action="?" method="post">

....

</form>
<?php endif ?>

Thank you for the continued support, it's really appreciated.

Regards,

Greg

By Damon - September 26, 2016

Hi Greg,

Change this:

<?php if ($showForm) && (!@$CURRENT_USER): ?>

to this:

<?php if (($showForm) && (!@$CURRENT_USER)): ?>

This will work for you. Let me know if you have any other questions.

Thanks!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Hi Damon,

Thanks for fixing my code. This now works!

Regards,
Greg

By Damon - September 27, 2016

Great, good to hear.

Thanks for the update Greg.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/