When using action "redirect to tokenized url" and token [account-url] I'm redirected to example.com/%5Baccount-url%5D so it seams the token is not evaluated at all. With URL field value of user/[uid] users are redirected to example.com/uers/%5Buid%5D. Maybe it's because users are not logged in when the page is generated? Can this redirection calculation be changed to a later stage when the user has been logged in already or is this, by design, not possible? I hope the former is the case!

I trigger this action after user login. Unfortunatelly this only applies to /user and not the login block.

Cheers.

Comments

greggles’s picture

Here are the steps I took to repeat this bug:

1. Create a new action from "redirect to a tokenized url" with the URL "user/[user-id]"
2. Visited admin/build/trigger/user where I assigned that trigger to "After a user has logged in"
3. Log out
4. Log in

Result:
No redirection to any place.

So, that was weird to me. I then changed around the code a little bit to debug it:

function token_actions_goto_action($object, $context) {
  $context['global'] = NULL;
  if (!empty($context['node']) && empty($context['user'])) {
    $context['user'] = user_load(array('uid' => $context['node']->uid));
  }
  $a = token_replace_multiple($context['url'], $context);
  drupal_set_message($a);
  drupal_goto($a);
}

And logged out and logged in. What this does is display the URL that is going to be redirected before doing the redirection. Interestingly enough, the output was user/1 (which is right) but I never got redirected.

So, it doesn't work for me either but I can't repeat the same bug that you have. Very strange...

kiamlaluno’s picture

If you are using Drupal 6.4 (and maybe Drupal 6.3), the redirection to the user page made when the user logs in is automatically done by Drupal core, without the need to set anything else.
If you are using any other Drupal versions, the page /user redirects a logged in user to his user page.

kiamlaluno’s picture

I have the same problem, but using the token '[uid]'.
I think this happens because the token action doesn't load the user object all times. It loads it if the context doesn't have an user object but it has a node object; in the case the context passed doesn't have both of them, the user object will not be loaded, and (I guess) the user tokens could not be replaced.

I don't have any problem using the '[user-id]'.

Actually, this happens with the development snapshot, but I think the token_actions.module is not changed from the 6.x-1.1 version, and the 6-x.1.x-dev one.

kiamlaluno’s picture

Component:Code» Token Actions
greggles’s picture

@Kiam - are you using the core trigger/actions module or are you using rules?

kiamlaluno’s picture

The issue I reported is referred to the use of the Token actions module with the core trigger/action module.

rmassamiri’s picture

I am having the same problem as the original author. I am using Drupal 6.6, Token 6.x-1.11, Token Actions 6.x-1.11, and have tried Rules 6.x-1.0-beta3 and Rules 6.x-1.x-dev. I noticed that the current dev version of Rules does not have a 'Page redirect with token' option. Has anyone discovered the problem or the solutions? Thanks.

kiamlaluno’s picture

Title:tokenized url redirection action not evaluating» Tokens are not evaluated
mariuss’s picture

Running into the same problem, it looks like none of the tokens in the "User tokens" group are available.

Beware that [user-id] is not the same thing, it points to the currently logged in user, which is not necessarily the user being edited.

benone’s picture

subscribe

benone’s picture

I set action for tokenized redirect and in Users Triggers I set - Trigger: When a user's profile is being viewed.
I have no idea which token let me for example go from user/23 to profile/ana

[user], [user-raw], [title], .......
None of them is working... Any suggestions ?

earnie’s picture

Version:6.x-1.11» 6.x-1.12

I have the same issue but with email. The [site-mail] for the recipient and the [site-name] in the subject line were replaced. The other tokens were not. From below, obviously this is assigned to a trigger for after a new user registers. This could be a module weight issue or could be broken core functionality. I have another issue not involving mail where I redirected the user to a thank-you page on registration. This caused the mail to not be sent at all, nor some of the user hooks. I'll have to go trip around the trigger module issues to see if I spot anything.

Recipient: [site-mail]
Subject: [site-name] New user [user]
Body:
[user]
[mail]
[reg-date]
[account-edit]

EDIT: Found core issues
#403446: Increase default weight of trigger module
#601398: Simpletest does not allow assigning actions to triggers

el_reverend’s picture

I also have problems where I cannot redirect a user to a tokenized URL upon log-in. I can redirect to a standard node (node/32), but the token does not seem to load.

cphoover’s picture

I am having the same issue!!!
Help someone I need this to do a simple sync to my supporter management software. This is a big bug why hasn't it been fixed yet?

aww’s picture

I'm having the same issue with the Token Profiles module:

After installing and enabling the Token Profile module, I can see the tokens in the 'Actions' section as such:

[user:profile_room_no]

I'm trying to use Trigger to direct logged in users to their "Classroom" (/path/room-101). The room assignment is set in a user's profile as "101". However, the string is passed directly to the browser and not converted to a path. In this case, the user logs in and gets a 404 because the token is passed literally (/path/room-[user:profile_room_no]).

Any help will be greatly appreciated!

Dave Reid’s picture

Version:6.x-1.12» 6.x-1.x-dev
Status:Active» Postponed (maintainer needs more info)

This will need to be re-confirmed with the latest 6.x-1.x code since #635570: Most tokens do not work in tokenized E-mails: [account:user], [account:mail] was fixed.

mattcasey’s picture

I can confirm the dev version fixes the token evaluation issue in email. I use Token actions to send tokens for user information after an account is created.

Dave Reid’s picture

Status:Postponed (maintainer needs more info)» Fixed
verta’s picture

subscribing, any way to find out when this will be a released version?

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

LrsK’s picture

Version:6.x-1.x-dev» 6.x-1.16
Status:Closed (fixed)» Active

I am getting this bug in Token version 6.x-1.16. I have some extra user data stored as a content type called "uProfile". I want to send an e-mail every time a user registers. The e-mail sending, and other tokens like [mail] work fine, but the tokens associated with the extra user content does not.

I am using Content Profile Tokens to access these tokens:

[content-profile-uprofile-name]
[content-profile-uprofile-org]
[content-profile-uprofile-phone]
[content-profile-uprofile-referral]

These tokens produce only empty data, making a blank e-mail if I only use the tokens for e-mail content.

The user data is stored fine, as I am able to access them on the user profile page as well as in the database.

Dave Reid’s picture

Version:6.x-1.16» 6.x-1.x-dev
Status:Active» Closed (fixed)

You would need to file a support request against the content profile module if those tokens do not work when given a user context.