Hi,

exactly following the steps described in http://drupal.org/node/199254#comment-879384, I created the Action "Forward to URL" (in my case: forward to node/71) which should be triggered by "User logging in"; that simply doesn't work.

Watchdog records that an action has been created (/admin/settings/actions/configure/1); watchdog does also record, that users are logging in; it does *not* record anything about triggers and no failed attemps to forward the user.

I've been looking around for documentation on actions/triggers and watched the screencast but haven't found any additional configuration steps or debugging approaches. Any ideas what's going wrong or suggestions where I could look what's happening?

Thanks & greetings, -asb

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acase’s picture

I have had the same problem trying to get my trigger to redirect the url after login...Have you heard any news on this?

asb’s picture

nope.

kvercruyssen’s picture

Trigger does work when logging in via /?q=user, not when the loginbox is in a block.

--> it's also a problem in 6.5

tjerkameel’s picture

So is there a workaround for this?

jvandyk’s picture

See explanation of what's happening here: http://drupal.org/node/321573#comment-1077089

marita93’s picture

Version: 6.3 » 6.6

I just hit this problem in Drupal 6.6.

miro_dietiker’s picture

Status: Active » Needs review
FileSize
706 bytes

Indeed the referred explanation of john explains the situation. See also
http://api.drupal.org/api/function/drupal_goto/6

I think the clear understanding of a redirect action is to override default behaviour. The destination is also being used to supply default workflows.
That's why i'd suggest the enforcement to be done in any case and stop making them overrideable by destination in general.

I know solutions/workarounds are things like form_alter.. But this is about general understanding of "what is an action" and precedence of default action, destination override and trigger action.

Or is this really a matter of contrib to have an action "Redirect to URL (force)"? (Or do we need to make it a feature request for D7?)

To open a third option to johns' i provide a patch to unset REQUEST values in core system.

tstoeckler’s picture

Version: 6.6 » 7.x-dev
Component: trigger.module » system.module

Rerolled for D7. Can be backported to D6 once it is comitted.

tstoeckler’s picture

FileSize
692 bytes

Oh, and here's the patch.

catch’s picture

Seems like a good change, but could use a test I think.

tstoeckler’s picture

I wrote a test for this patch and I got one fail at the very end which proved the bug that this issue is about. Then I applied the patch in #9 and I still got the same fail. So I don't know whether the fail is due to a wrong approach in #9 or whether it's the test.
Therefore I am attaching a patch for trigger.test, in case someone wants to jump in and help.
NOTE: I thought that maybe drupalLogin doesn't work with the redirect, but using a workaround didn't work either.
ALSO NOTE: This is the first test I wrote (Yay!), so if you've got anything to say to improve the test, bring it on =)

tstoeckler’s picture

FileSize
2.11 KB

Hmm. Maybe it'll work now...

Status: Needs review » Needs work

The last submitted patch failed testing.

tstoeckler’s picture

Also worth noting: I tested the patch in #9 manually and it still works (and it doesn't without it), so very weird.

WolfBenz’s picture

Hi all,
I'd like to use this as well... can anyone give me a hint on in what exact release of D6 a solution for this bug will be integrated?
-- Wolf

tstoeckler’s picture

You can try the patch in #7 for Drupal 6, but if you want to see it committed to core we must see to get this in Drupal 7 first. As you can read in #11 I tried my best, but am stumped on the failing test. Therefore someone more knowledgable in Drupal than me would need to finish this off. I don't think it's very hard, but it IS over my head.

miro_dietiker’s picture

Hmm... it seems to me like simpletest doesn't support any redirect.. am i wrong?
It only parses the answer of the output. Redirect (header, mega) are actions that possibly would need to be triggered after (explicitly or implicitly).
Could be we even need to extend simpletests' api for this?

andypost’s picture

Status: Needs work » Needs review
FileSize
1.94 KB
+++ modules/system/system.module	15 May 2009 14:59:04 -0000
@@ -2190,6 +2190,12 @@ function system_goto_action_submit($form
+  if (isset($_REQUEST['destination'])) {
+    unset($_REQUEST['destination']);
+  }
+  if (isset($_REQUEST['edit']['destination'])) {
+    unset($_REQUEST['edit']['destination']);
+  }

drupal_goto works with $_GET http://api.drupal.org/api/function/drupal_goto/7

Patch with redirect combined from #306662: Add redirect option to site-wide contact forms and user.test

Status: Needs review » Needs work

The last submitted patch failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
2.07 KB

I find no ability to assign an action to "Redirect to URL' trigger because simpletest limitation - DrupalPost() does not allows to post a right form.

page admin/structure/trigger/user have 7 forms and DrupalPost posts into first

This patch with debug() to point that both actions get assigned to same hook but this case needs 'user_login'

andypost’s picture

Status: Needs review » Postponed

Status: Postponed » Needs review

schorrie requested that failed test be re-tested.

Status: Needs review » Needs work

The last submitted patch failed testing.

andypost’s picture

Priority: Normal » Critical
Status: Needs work » Postponed

Bot goes crazy... Suppose this bug critical

jrivelli’s picture

any news on this? It would be nice if we could use the login block with the url redirect!

andypost’s picture

catch’s picture

Priority: Critical » Normal
Status: Postponed » Needs work

Let's get the bug fix in, and the test separately - it's too late in the game to be holding up real bug fixes on test framework bugs. Also this isn't critical, just a regular bug.

andypost’s picture

Status: Needs work » Needs review

My patch from #20 still works but included test requires simpletest to be fixed first

tannerjfco’s picture

Experiencing the same problem here. Happens with Trigger/Action setup and with triggered action with Rules Module. Patch in #18 works, but patch in #20 doesn't for me.

tannerjfco’s picture

Also experiencing similar issue with setting up a redirect upon account creation. Patch in #18 got it to redirect correctly, but seems to keep the login process from happening, as the user is directed but access is denied because the user is not logged in.

saifya’s picture

Same here on 6.15. After one-time login and forced password change, Trigger breaks all subsequent login attempts.

Status: Needs review » Needs work

The last submitted patch, 286668_redirect_trigger.patch, failed testing.

andypost’s picture

Status: Needs work » Closed (duplicate)

Duplicate of #732542: system_goto_action breaks core APIs
Test from #20 moved

metalman’s picture

I had the same problem with the login block not triggering the login trigger. I solved it by borrowing some code from the /user login page and making a custom login block using that. That way, the block and the main login page are basically the same and the trigger works fine.

The code looks like this

<form action="/user"  accept-charset="UTF-8" method="post" id="user-login">
<div>
<div class="form-item" id="edit-name-wrapper">
	<label for="edit-name">Username: <span class="form-required" title="This field is required."></span></label>
	<input type="text" maxlength="60" name="name" id="edit-name" size="10" value="" class="form-text required" />
</div>

<div class="form-item" id="edit-pass-wrapper">
	<label for="edit-pass">Password: <span class="form-required" title="This field is required."></span></label>
	<input type="password" name="pass" id="edit-pass"  maxlength="128"  size="10"  class="form-text required" />
</div>

<input type="hidden" name="form_build_id" id="form-1be10d0240f87db613d56367e51e6441" value="form-1be10d0240f87db613d56367e51e6441"  />
<input type="hidden" name="form_id" id="edit-user-login" value="user_login"  />
<input type="submit" name="op" id="edit-submit" value="Log in"  class="form-submit" />

</div>
</form>

This is just a simplified and condensed version of the main login page. It activates the triggers just the way it is supposed to and it looks very much like the original trigger block.

Of course, you need to use Full HTML input and it looks best if you have Line Break Conversion turned off.

Hope this is helpful.

Anonymous’s picture

Status: Closed (duplicate) » Needs review

#9: enforce_goto_action_D7.patch queued for re-testing.

TaKuma-2’s picture

#7: enforce_goto_action.patch queued for re-testing.

andypost’s picture

This issue still valid for D7 while D8 has no trigger module no more

nishant_k’s picture

12: test_redirect_login.patch queued for re-testing.

The last submitted patch, 12: test_redirect_login.patch, failed testing.