Action Redirect to URL does not work
4kant - October 15, 2008 - 12:23
| Project: | Actions |
| Version: | 5.x-2.6 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi,
I have installed actions 5.x-2.6 on drupal 5.10 (of course will update to 5.11 ;-)
My aim is to redirect user after they have logged in to a special url ("webfm" - the webFM Manager).
I created an "advanced action" "Redirect to URL" and configured the URL webfm.
Then I chose the trigger "Trigger: After a user has logged in".
After that I tried to log in as a user - but the frontpage stayed the same.
What did I do wrong?
thanks
4k

#1
Sorry - but after 2 weeks without any answer, I´d like to ask whether somebody can tell me:
the way I tried to achieve the redirect - did I do that right?
Or did I misunderstand the usage of these modules?
Thanks
4k
#2
You are doing it right. But, there is a problem. The Redirect to URL action calls drupal_goto() to do the redirect to the new URL.
But drupal_goto() isn't doing what it was told.
That's because drupal_goto(), before going to the URL you passed, checks to see if the
destinationhas been set. If it has been set, it ignores the URL you passed in!From the code comments for drupal_goto():
* Usually the redirected URL is constructed from this function's input* parameters. However you may override that behavior by setting a
* <em>destination</em> in either the $_REQUEST-array (i.e. by using
* the query string of an URI) or the $_REQUEST['edit']-array (i.e. by
* using a hidden form field). This is used to direct the user back to
* the proper page after completing a form. For example, after editing
* a post on the 'admin/content/node'-page or after having logged on using the
* 'user login'-block in a sidebar. The function drupal_get_destination()
* can be used to help set the destination URL.
We can either rewrite the code that executes in the Redirect to URL action to not call drupal_goto() and just do the redirect itself, or we could write a new action called "Redirect to URL (force)" or something.
But anyway, that's why you're experiencing the behavior you reported.