Hi
Some of our site users seem to have trouble reading the green message ["Further instructions have been sent to your e-mail address."] that appears when they use the request new password form.
Rather than actually checking their email as instructed, they are writing to tech support and moaning that the request password process is broken [it's not, its an EBKAC in these cases].
Tech support are now getting frustrated at some users lack of ability to read big green messages and would like me to change the request new password process.
Instead of the request new password ending up on the login [/user] page, can I either remain on the request new password page [/user/password] with an appropriate message, or can I end up redirecting to a custom page? The custom page would be preferable as there would be no form on it to confuse them.
I have tried a quick custom module to see if this would actually work:
function theme_form_alter(&$form, &$form_state) {
if ($form['#action'] == "/user/password"){
$form['#action'] = "/custom-page";
}
}
and it does exactly as it should, set the form action to the /custom-page, but the form processing on the original /user/password is no longer there so nothing actually happens. ;) So no real surprises there.
Any suggestions would be gratefully received,
thank you for your help
ice70
Comments
Try using the 'redirect' key
Try using the 'redirect' key instead of #action and the $form_state:
See drupal_redirect_form() for more info
-= Gerrit Brands
Hi, thank you for your
Hi,
thank you for your reply.
I have updated the function as follows:
The second var_dump($form_state) output is
The only difference between the first and second var_dump() is
first output
["redirect"]=> NULL
second output
["redirect"]=> string(7) "node/20"
I have tried using various permutations of:
$form_state['redirect'] = "node/20";
$form_state['redirect'] = "/node/20";
$form_state['redirect'] = "http://www.domain.com/node/20";
$form_state['redirect'] = "url_alias name";
$form_state['redirect'] = "/url_alias name";
$form_state['redirect'] = "http://www.domain.com/url_alias name";
and so on, but each time I do a new password request, the form processes and end up at
/user
with the green message saying the email has been sent.
I have checked the triggers that prevent redirection on the link sent through drupal_redirect_form()
If $form_state['redirect'] is FALSE, a form builder function or form validation/submit handler does not want a user to be redirected, which means that drupal_goto() is not invoked.
If $form_state['no_redirect'] is TRUE, then the callback that originally built the form explicitly disallows any redirection, regardless of the redirection value in $form_state['redirect'].
If $form_state['programmed'] is TRUE, the form submission was usually invoked via drupal_form_submit(), so any redirection would break the script that invoked drupal_form_submit().
If $form_state['rebuild'] is TRUE, the form needs to be rebuilt without redirection.
And the var_dump() does not look to meet any of these.
Any idea what I have missed?
Thank you for your help
ice70
Perhaps try altering the
Perhaps try altering the
$form_state['redirect']
in a submit handler. Something like this:Hope this helps!
-= Gerrit Brands
Thank you!
Hi Gerrit Brands
that works exactly as it should, thank you for your help! :)
ice70
Can anyone share this as module
Hi,
I have the same struggle, can anyone post this as module for D7?
Thanks
how i changed the redirect on password page
I put this into my template.php and it works for me
Diana Castillo
Worked for me too - I created
Worked for me too - I created a page with more info about checking spam folder etc and redirected to that.
Like the OP, we regularly get users complaining that they do a password reset and then are asked to enter their password, but they don't know it - they just haven't read the status message about the email being sent to them and simply think they are now being asked to login.
I've also combined this with this module https://www.drupal.org/project/simple_pass_reset to then provide a simple form after clicking the password reset link that just shows the password fields where they can enter their new ones - rather than the whole user profile, which again led to confusion as users then don't realise they need to enter a new password after clicking the link.
Not working with Radix Stanley
Hi guys, sorry very much a noob at the template level. I tried to paste in @dianacastillo's function in template.php, cleared caches, etc...but still not getting a re-direct to my specified node.
Strange that this "trigger" does not appear in the list of core actions that Drupal knows about. If it were acknowledged as a proper action then I could solve the problem very simply with Rules.
Any help with the function would be greatly appreciated.
John Brisbin
Managing Director, BoaB interactive
[mb] +61 (0)4 0747 1565
[im] skype:boabjohn
[www] http://www.boab.info
[ph] +61 (0)7 4094 2172
[m] POB 248 MT Molloy QLD 4871 AUSTRALIA
Hello Boabjohn,
Hello Boabjohn,
I have created a custom trigger for this, I will try to patch this into Drupal 7 if the drupal.org approves.
Please find my comment below for the code.
Thanks!!
Hi, I have added the
Hi, @vali hutchinson I have added the following code to simple_pass_reset.module, at the bottom of the page
but the page does not redirect to front page after submitting a new password. Do I need to modify anything in the l module file? thanks
Thanks for the simple snippet
Thanks for the simple snippet - works for me, and saves the confusion of the end user still seeing a login form when that's the page they've just come from.
Custom Trigger
Hello Guys,
To achieve this, I prefer to have a custom trigger which will give freedom to end user to select the page of his choice whenever he/she wants, instead of fiddling with code every time. Use below code to create a custom module and install it in your environment. Once done you will find the trigger in your triggers list.
Please let me know if you find any issues with it.
Thanks!!
@umeshpatil This does work -
@umeshpatil This does work - the user is redirected to a specific page after the password reset link is clicked...
however I'm getting the following error:
Notice: Undefined variable: options in [modulename]_user_password_reset() (line 61 of /var/www/html/[site]/sites/all/modules/_custom/[modulename]/[modulename].module).
Line 61 reads:
Suggestions on how to get rid of the error would be appreciated.
@umeshpatil - fixed it
I went and added a line to the last part of your code and, at least for me, it resolved the error messages. I just added "$options = array();" to the last function. It now reads as follows (without my "added line" comment):