Needs work
Project:
Drupal core
Version:
main
Component:
user system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Jan 2006 at 19:58 UTC
Updated:
13 Jan 2019 at 14:41 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
m3avrck commentedThis patch cleans up the wording and also the issue of
<front>not showing up in the help text. Tested and working great, I'd say this is RTC!Comment #2
Jaza commentedThis patch moves the new form items to their own fieldset, "User redirection settings", as they don't (all) belong in the registration settings fieldset.
Also converted the patch to use UNIX linebreaks, and removed unneeded blank lines from bottom of the file (this was causing the patch utility to give warnings).
Comment #3
m3avrck commentedSounds good to me, updated against HEAD.
Comment #4
moshe weitzman commentedif you make destination a hidden form field, then you can remove the parameters to drupal_goto(). drupal_goto already checks the $_REQUEST for a field called destination and redirects accordingly. saves a few characters.
i do have some reservations though. these preferences will override any on the querystring. I might have a link like q=user/login?destination=taxonomy/term5 from a certain part of my site. but with this patch my specified destination would be ignored. would be good to smarten the patch to recognize this circumstance. just check for existence of $_REQUEST['destination']
Comment #5
merlinofchaos commentedTry this version
Comment #6
moshe weitzman commentedUm, I'm pretty sure you can replace as follows:
- drupal_goto($_REQUEST['destination'] ? $_REQUEST['destination'] : ($form_values['destination'] ? $form_values['destination'] : NULL));
+ drupal_goto();
drupal_goto() already does what you seek. My only gripe is that you add a destination param to the form even when one has been supplied in the URL. Thats clobberring.
Comment #7
merlinofchaos commentedI'm quite sure drupal_goto won't check $form_values['destination'] if $_REQUEST['destination'] doesn't exist.
I'm not sure I see how adding 'destination' to the form even if one was in the URL already (and at that level I find it unlikely there was a destination in the URL, but someone could do it, sure) is clobbering.
Comment #8
moshe weitzman commentedif you change the following to a hidden field, then you can simplify the drupal_goto() calls as I suggest: $form['destination'] = array('#type' => 'value', '#value' => variable_get('user_post_login_page', 'user'));
some modules change the 403 acces denied into a login page with the proper destination. in this case, we don't want the user going to the admin decided destination - he already had a destination in mind! thats what i mean by clobber. my suggestion is to not lay down the hidden field at all if isset($_REQUEST['destination'])
Comment #9
merlinofchaos commentedBut that's why there is the check in the drupal_goto() statement.
Ok, it's true that you could do an if isset() before the $form['destination'] statement, and instead your drupal_goto looks like
drupal_goto(isset($form_values['destination']) ? $form_values['destination'] : NULL)which I don't really see as being either better or worse than the one that's already there.
Comment #10
merlinofchaos commentedWe could also write the dest directly into ['destination'] but that means fiddling with '#name' => 'destination' which I suppose is ok.
Comment #11
moshe weitzman commentedhow about reviving this?
Comment #12
LAsan commentedhow about reviving this?
Moving to cvs.
Comment #13
lilou commentedComment #14
swentel commentedTotally support this patch. Didn't apply anymore of course with all the filename changes and function moves. Reapplied it to cvs, untested, so please review!
Comment #15
Anonymous (not verified) commentedSubscribing. So what's logintobbagan to do now? ;p
Comment #16
dave reidThis patch really does not need to check for $_REQUEST['destination'] since drupal_goto handles that automatically. If there is a $_REQUEST['destination'], the extract() in drupal_goto will overwrite the current path parameter.
Comment #17
sunUgh. Found this issue too late.
Got a working patch for a custom logout path in #452462: Allow custom logout page - shall I move that patch over here?
I basically agree that admin/user/settings may be a more accurate location to place these settings. (I added to admin/settings/site-information, where front page, 403, and 404 are located already.)
Comment #18
sunMarked #452462: Allow custom logout page as duplicate of this issue. In there, people suggested to simply use triggers/actions for this purpose, which not only makes sense, but also allows further customizations.
Re-attaching my patch from the other issue (only for reference).
@merlinofchaos: Are you still up for working on this?
Comment #19
tstoecklerWithout actually having tested it:
Custom redirect page after register is possible by using the "After a user account has been created" trigger and adding a redirect action, which is actually possible. I'm at least guessing that's what's the trigger is for, that would have to be validated.
Custom redirect on login is there with triggers and actions, even though it doesn't work as I recently noted in #451498: Redirect on login broken with action/triggers. As I noted there I assume this is due to some special-casing in user.module for the login process.
I don't know if #451498 should be marked "duplicate" if there is an approach here or if that should be handled seperately as it's really a bug report.
Custom redirect on logout would theoretically be possible...:
Well, there is the "After a user has logged out" trigger, but the problem is, you can't assign a redirection action to that trigger (as I noted in #452462: Allow custom logout page). I have no clue whether there is a reason for that or if that problem could simply be solved by making that action available.
Just some notes for now, I hope to play around with all this a little more in the next days.
Comment #20
sunAnd again, someone in IRC asked "How can I redirect users to a certain page after login?"
Comment #21
crotown commentedI just marked #451498: Redirect on login broken with action/triggers as a duplicate of #286668: Trigger "User logging in" doesn't work with Action "Forward to URL". Note that a solution for the after-login redirect is proposed there. The patch solves the problem for me in the latest head.
I agree that the idea that we should not duplicate (and conflict) with things already there in actions/triggers. We should simply make sure the options that are already there in actions/triggers work.
Comment #22
tstoecklerI tested the patch at #286668: Trigger "User logging in" doesn't work with Action "Forward to URL" and it works. I've rerolled it for D7. So we need to review and commit that. That gets us a third of the way.
Custom page upon registration: Is theoretically possible with actions/triggers.
I tried it, and upon registration you are redirected to the page, but you are not logged in, which isn't expected behaviour. Without the redirect action, you are logged in, after registration. I tried the patch, from #286668: Trigger "User logging in" doesn't work with Action "Forward to URL", but that didn't work either. So that needs to figured out.
Custom page on logout: Still the same as in #19
Comment #23
Andrew Himes commentedsubscribe
Comment #24
sunIntroducing a new tag for feature freeze: API clean-up.
Comment #25
sunIt would really really be nice if someone would step up now to provide a patch for this.
Comment #26
andypostMain problem for redirects is in conflict of drupal_goto() with drupal_get_destination
Patch #286668: Trigger "User logging in" doesn't work with Action "Forward to URL" is simple
And this allows to proceed to a redirect page because user_login_block sets 'destination'
We have no ability to write good tests for triggers as explained #20 at #286668: Trigger "User logging in" doesn't work with Action "Forward to URL"
Comment #27
andypostshould wait till #601398: Simpletest does not allow assigning actions to triggers
Comment #28
sunSadly, this didn't make it.
Comment #30
asb commentedsub
Comment #37
avpaderno