I know that redirects were recently implemented in 7.x-4.x, however this module was recently implemented in a site which took the functionality of login redirects away from existing logic. At first I thought I could implement either some hook overrides or even try to specify a path that I could then do additional logic. I realized though, that this really wasn't the best approach. Here is a patch that I feel should be implemented in this module or something of the likes. It helps standardize redirect options for each of the three forms.
Because this changes the UI and the functionality of redirects so drastically, I also included an update to rename existing variables to something that was more suited for their purpose.
I feel that this is a good direct to start with, please let me know if I need to refactor my patch as I am ultimately unfamiliar with your module and may have missed something! Great module btw!
Thanks,
Mark
Comment | File | Size | Author |
---|---|---|---|
#4 | ajax_register-redirect-support.patch | 13.04 KB | markhalliwell |
#2 | ajax_register-redirect-support.patch | 15.95 KB | markhalliwell |
ajax_register-redirect-support.patch | 11.56 KB | markhalliwell |
Comments
Comment #1
SpleshkaHi! Thanks a lot for your patch! So appreciate! Here is some comments:
You can't provide "No redirect" for user login. Page should be reloaded or redirected anyway.
A lot of empty spaces in patch.
1. It is better to use theme('item_list') instead of manual <ul><li>
2. Redirect path may be stored not only in $form_state['redirect'] but in $form['#redirect']
3. Same as before: a lot of empty spaces.
After comment should be added dot (ccording to Drupal coding standarts).
Please, provide new line at the end of file.
This line should be separated into two lines.
This line in unnecessary at all.
Empty spaces should be removed from the patch.
isset($form_state['redirect']) is unnecessary here.
This line is unnecessary.
P.s. Please, set status Needs review when providing a patch.
Comment #2
markhalliwellI could have sworn I put it as Needs review, guess not, my apologies.
To be honest, I usually don't include any spaces at all (as you can see in the update I provided). But in the admin.inc, I was following existing format. I've been scolded about stuff like this before because I didn't follow existing format, so I just used existing line spacings in the previous patch. I completely agree with you though, they should be taken out.... so I went ahead and removed the ones above in the code I didn't touch to keep conformity.
One thing I didn't do was run the patch through coder. I did this time and fixed a few things that it found as well. I recently came across another issue where I did something similar and they told me to create a new issue because it wasn't related. So I am willing to do what ever you want as you help maintain the module :)
$form['#redirect']
was used in D6, it was taken out of D7. See: 7: drupal_redirect_form() and 6: drupal_redirect_form()Actually this line IS necessary. It matches the
<noredirect>
in the URL variable, sets the behavior variable to 'none' and then removes<noredirect>
from the URL variable because it is no longer needed in that variable. Below, you'll see that I only set the new variable if the URL is not empty. This way, it cleans up which variables are actually set.Summary:
I made the rest of the suggested changes :)
Comment #3
SpleshkaThanks a lot, now it is much more better! I am very pleased that you are interested in this module. But patch still needs to be processed more carefully:
1.
I guess you shouldn't remove empty lines between form and menu elements. It makes code more difficult to read.
2.
I see empty space here :) Actualy, I found three extra spaces in the code. I know that it is not so important, but if you will make a new patch, please remove them.
3.
Form could be redirected by $form['#action'] as well. $form_state['redirect'] will be empty in this case.
4.
Message is not translatable. In your case message will be pasted "As Is". Here is correct code:
drupal_set_message(t($message));
Comment #4
markhalliwellPlease see my above comment about why I did what I did. I'll put them back, but this is the last patch I'll submit about spacing issues. The patch is solid and works beautifully, cosmetic changes can be made by you after if you so desire.
You're using
ctools_modal_form_wrapper()
to alter the$form_state
via reference. There isn't even a$form
to check for$form['#action']
. What you are asking for isn't possible given the current implementation.I had changed this from the original patch because Coder gave me a strict error about this line. I was tweaking it until it went away, in all honesty, I didn't even check to see if it was that functional. Changed it back and added a
check_plain()
call to satisfy coder.So just to re-mention it, this is the last patch I'm willing to make. Aside from the small bugs I just fixed, there seems to be just nit picking going on now. If you feel there should be line spacing changes here or there, please make them yourself.
Comment #5
SpleshkaGreat! Now everything is perfect. Commited at b596642. Thank you for your work, I'm so happy :)