Hi,
I'm using the 6.x-1.14 version of the Ajax module in a Drupal 6.20 website. I've found a problem with redirections and drupal messages. For example: when a user goes to http://example.com/user/password to request a new password, provides an email address and clicks the button, the user is correctly redirected to the http://example.com/user page, but the message "Further instructions have been sent to your e-mail address" set by the Drupal core's user module in the user_pass_submit() function is never shown to the user.
I've tried to track the problem and when the Ajax response is sent back to the browser, the Drupal.Ajax.response function is called, and the "// Redirect else{...}" section is executed. In this section, the "Drupal.Ajax.invoke('complete', data)" returns FALSE, so the redirect is executed but the "Further instructions have been sent to your e-mail address" message is lost and never shown to the user.
I think this is a bug in the Ajax module. Any ideas about how to get these messages shown to the user?. Any help will be more than welcome. Thanks in advance.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | ajax_redirect_messages_2.patch | 1.02 KB | Aleksey Zubko |
| #1 | ajax_redirect_messages.patch | 1.55 KB | GoddamnNoise |
Comments
Comment #1
GoddamnNoise commentedHi again,
I've made a patch to solve this problem. This patch includes the patch http://drupal.org/files/issues/ajax_module_redirect_2.patch (comment #21 at http://drupal.org/node/413242) too. I hope it will help anybody facing the same problem. Could any of the Ajax module maintainers test the patch and provide feedback?. Thanks in advance.
Comment #2
igorik commentedsubscribe
Comment #3
Aleksey Zubko commented@GoddamnNoise
Thank for patch, but in my case this patch make wrong redirect ($data['redirect'] == '//' and I don't known why )).
My patch work fine for me.
Comment #4
GoddamnNoise commentedIt works like a champ for me, maybe you've installed another patch which is making the difference.
Comment #5
Aleksey Zubko commentedmaybe in my site other module made this broken redirect
Comment #6
GoddamnNoise commentedYeah, i think that could be the problem!
Comment #7
j_ten_man commentedDoes not work if you have
destinationin the query string as it is handled in a different place but the messages are lost. Changed (in the patch from #3)to
Comment #8
dep85 commentedHello, patch from #3 works fine, but not for login and registration form.
When I go through registration i can't see any message 'email was sent' or after login 'Login successful'. Maybe somebody figured out and fix that problem? I changed patch according to #7 as well ,but it doesn't work any way.
Comment #9
brendoncrawford commentedIs there a reviewed working patch that I should apply here?
Comment #10
botanic_spark commentedI also have problem with login and register form. Can somebody please help?
Comment #11
chezwel commentedAlso having the issue with the registration and login form deleting user messages on redirect.
Comment #12
arski commentedI have this on a custom form too.. if I set $form_state['redirect'] to something meaningful, the messages I set in the submit hook never get displayed on the redirected page.. If I don't set the redirect, they get displayed by AJAX, so.. not sure what's going on there, but it's not nice :(
Comment #13
arski commentedThe patch almost fixes it for me, though it does not address the same issue in ajax_validator - if any messages are set during some validate function, they're still lost for me.. I just solved this for me by setting the 2nd parameter to FALSE, but that's obviously not perfect.
Comment #14
nor4a commentedI had the same problem - but not using AJAX module.
The solution for it is to add a record to the users table with ID 0!
The user with ID 0 seams to be important thing in the Drupal 6 system!