I'm send out a tokenized email triggered by a user's profile being updated.

This is what I'm getting:

User: [account:user] has been updated. Email: [account:mail]
[account:account-edit]
[account-url]

Nothing expands to the value.

Any ideas?

Richard S Albrecht

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Hawkcode’s picture

Title: My Tolenized emails to not expand the tokens » My Tokenized emails to not expand the tokens
spgd01’s picture

Component: User interface » Token Actions

I have the same problem. I have posted literaly every token listed http://drupal.org/node/390482 and only the ones relating to my web site show:
[site-url] The url of the current Drupal website.
[site-name] The name of the current Drupal website.
[site-slogan] The slogan of the current Drupal website.
[site-mission] The mission of the current Drupal website.
[site-mail] The contact email address for the current Drupal website.

None of the user tokens work

Hawkcode’s picture

Priority: Normal » Critical

Same tokens work for me too.

So what does one due if he can't figure it out?

There has to be someone that can help us???

I'm on 6.12 what are you on?

Hawkcode’s picture

I just tried the same tokenised email - with all the tokens and a fair amount of them worked for updating a node.

They Don't work for updating a user.

A little more info.

Rich

stevelack’s picture

I'm having the same issue. None of the User tokens work in an email sent via an action that is triggered when a new user registers. The global tokens seem to work but not the user tokens.

Anybody have any idea how to fix this?

spgd01’s picture

Title: My Tokenized emails to not expand the tokens » My Tokenized emails do not expand the user tokens

I am still having the same issue. When a trigger action sends an e-mail because of a new user I do not receive any user token info in the e-mail. I only see the actual token: [user] Does anyone have any solutions? Is anyone looking into this?

Alan.Guggenheim’s picture

Same thing here. I am trying to send emails following user registration, and tokens are not expanded.
I also need to use tokens from CiviCRM for emails. What is the proper syntax? In views, I can see the CiviCRM fields, including custom fields.
Thanks

Alan.Guggenheim’s picture

Same problem Drupal 6.15 and Token 6.x-1.12

Dave Reid’s picture

Title: My Tokenized emails do not expand the user tokens » E-mails only support global tokens
Priority: Critical » Normal

This isn't really critical, but it needs to be documented that the token action e-mails don't support non-global tokens because the mails aren't provided any kind of 'context'.

Alan.Guggenheim’s picture

No, I think it is a bug and can be fixed. It has been fixed, for example in http://drupal.org/node/329267
Send tokenized email to members of a role
It is very important to be able to do this in workflow, processing new, changed, deleted users,...

Alan.Guggenheim’s picture

Category: support » bug
xqbzzr’s picture

Same here with rules and emails.

Alan.Guggenheim’s picture

Title: E-mails only support global tokens » Only globen tokens work in tokenized E-mails
robby.smith’s picture

subscribing

Jim Ruby’s picture

subscribing

Alan.Guggenheim’s picture

Title: Only globen tokens work in tokenized E-mails » Most tokens do not work in tokenized E-mails: [account:user], [account:mail]
Priority: Normal » Critical

I changed the title and the priority, as this is critical for my operation: I need to send an email to several people upon a new user registration, with that user information (name, email, address, and other fields).
For some reaso these tokens are not properly expanded. It seems to be a context issue, but I am not able to find out where is the bug.

Help,...

Rob T’s picture

I need the same type of functionality. Truth be told, I am shocked this wasn't already a feature of the module.

Alan.Guggenheim’s picture

I think it is a feature, there is no indication that it would not work. There is a bug, apparently, the contaxt is not properly updated/read when a new user is created, but nobody seems to be looking into it.

xqbzzr’s picture

Ahm, Ive had the same issue. At least I thought i had. BUT - I double checked all the tokens and found out that there are some differences in how to use the tokens depending on the modules providing them.
For example when using the "Send email to external adress" I have to use the [node:author-name-raw] and [user:user-raw] tokens. When sending the exact same "mail to a User-Reference Field" from this node, the tokens will not work. Instead I have to use the [author-name-raw] and [user-raw] tokens (without the "node:"). I looked into most of my tokens and could fix nearly every issue just by keeping the right syntax.
Is that of any help?

Alan.Guggenheim’s picture

Thanks, but what I need to do is send an email upon user registration and I looked, and I did not find any other token that works.

yan’s picture

Same here: I want to send the data of a newly registered user and the tokens don't work. I don't see any [account: ...] or [user: ...] tokens, though.

tmetzger’s picture

Bit of a pain! Did it ever work? Subscribing.

Alan.Guggenheim’s picture

Not working so fasr in tokens/Actions
Some limited working tokens through rules: Send a mail to all users of a role
[account:user] [account:uid] [account:mail] [account:reg-date]

Very frustrating.

kfurlotte’s picture

subscribing

bryancasler’s picture

subscribe

locomo’s picture

subscribe

venusrising’s picture

Same issue here. There is a huge list of tokes but I can only get %username $site_name %node %title to work. Nothing in brackets works at all.

ATB’s picture

Having the same problem. I need to send an email upon user registration to 2 admins, and have them look at the account and decide, based on info in the form, whether they should have certain types of access. None of the user tokens expand.

quex’s picture

I have found solution to send token values for user actions in e-mails. In function token_normalize_context() put this:

 if($context['hook'] == 'user' && !empty($context['account'])) {
      $context['user'] = $context['account'];
  }

It works for all actions ('view', 'insert', 'update', 'delete', 'login') in user hook!

venusrising’s picture

quex can you clarify, I just wanted an email that would let me know when a new user registered(which I have working ) but I want a link to the name date and user profile link and cannot get it to work. Thanks for your reply.

quex’s picture

@venusrising:
At first add token action in admin/settings/actions with this content:

name: [user]
date: [reg-date] 
profile link: [site-url][account-url] 

Next you need add trigger, go to admin/build/trigger/user and select you token action from list.

It's very simple and it works for me :-) You just need apply my solution posted in earlier comment.

keithmorr’s picture

quex,

can you clarify where the file is that contains token_normalize_context() so that I may apply this fix?

I am in Drupal 5.

Thank You

quex’s picture

Well, i'm using drupal 6.

In drupal 6 it's in token_actions.module file, token_normalize_context() function.

Sorry, i cannot help you with drupal 5.

ShutterFreak’s picture

Subscribing, and very curious to know whether #29 will make it in CVS.

yan’s picture

Version: 6.x-1.12 » 6.x-1.13
FileSize
474 bytes

Here's #29 as a patch, but I haven't tested it.

rkdesantos’s picture

Version: 6.x-1.13 » 6.x-1.14

subscribing

rkdesantos’s picture

Issue tags: +User Tokens e-mail

I applied the patch manually to the latest version of token_actions.module (v 1.4.2.9 2010/03/25 17:49:43) with the current 6.x-1.14 version of the rest of the module and no success.

Dave Reid’s picture

Status: Active » Needs work
MisterBigs’s picture

Hi,

I think I'm having the same problem. I am using this in a tokenized email [example-contact] where I've implemented the example_token_values and example_token_list in my module. My module has a form, created with the form api, that gets stored in a custom table. My token are listed when I view all available token so I know that example_token_list is working but when example_token_values is called $type doesn't come up as equal to 'example'.

I need to pull information from the submitted form and display them on the tokenized email that is sent out. Am I missing a function? The Trigger I created is working and fires when the form is submitted and the Action is sending out the email the problem is that the tokens are not being replace with the form's values.

I'm running 6.x-1.14

bryancasler’s picture

I'm running token version = "6.x-1.12" with the patch from #35 and everything is working for me. Been using it for a while now with no problems.

ayalsule’s picture

subscribe

jpamental’s picture

Just chiming in that with token 6.x-1.13, applying the patch from #35 above cleared up the same issue for me (user tokens not evaluating)

Jason

MisterBigs’s picture

I applied the patch on #35 and it still did not work.

jpamental’s picture

The bug seems to still exist in 6.x-1.14 - but the patch from #35 still works perfectly. (that's with all other modules up-to-date, core 6.19 installed)

riisi’s picture

Applied #29 to the location per #33. It works!

For anyone else looking for a similar solution, I wanted to use the VBO 'send tokenized e-mail' action to send emails to users with their recorded profile details (address, phone no. etc) so that they can check. Installing Token Profile (http://drupal.org/project/token_profile) provides user profile tokens which now work with the above patch.

shady_gun’s picture

same problem here .. i can't get the cck tokens to work with the tokenized mail .....

subscribing

vgeck’s picture

Subscribing.

ndwilliams3’s picture

confirming that patch also worked for me against core 6.19 and token 6.x-1.14 and token_profile 6.x-1.0-beta1.

MaffooClock’s picture

I can confirm that the patch in #35 worked for me (Drupal 6.19, Token 6.x-1.14).

I had an action to send me an email when a new user account was created, but none of the tokens were replaced.

An account has been created for a new user.

Username:    [user]
Email:       [mail]
IP Address:  [ip-address]

Profile:     [account-edit]

After applying the patch, the email above was correctly populated.

brisath’s picture

subscribing

venusrising’s picture

I applied the patch so some stuff works now

I have an email to let us know when new content is created and so far it works with on exception Okay this is weird not sure how to get this event to trigger after pathauto so the url is pathuto friendly.

Hello [site-name]-
[author-name] [account-url] submitted a new [type-name] "[title]"
[node-url] on [small].

This all works but upon creation it will only send the none url friendly alias for node URL. If I have this rule trigger for updates and creation it will send the friendly url for an update.

pumpkinkid’s picture

Having same problems... I applied the patch to 6x-1.14 and it did not work...

pumpkinkid’s picture

Actually, it seems as before the patch was not properly applied... I re-patched the module on my site and it is now working as expected.

jweedman’s picture

Status: Needs work » Reviewed & tested by the community

Based on #40, #42, #44, #45, #48, #49, #51, #53, and my own experience (#54), this little patch is doing the trick.

Hopefully we see this issue resolved in the next release. In the meantime, thanks @quex & @yan for the code and patch. Works great. Changing Status to reviewed & tested. I'll leave the patch porting to those who created the patch.

Everyone looking for an answer check comments #29 & #33 for a manual fix, and #35 for a patch of the same solution.

Dave Reid’s picture

Version: 6.x-1.14 » 6.x-1.x-dev
Status: Reviewed & tested by the community » Needs review
FileSize
13.79 KB

Formal patch against 6.x-1.x with improved tests for review.

Dave Reid’s picture

Revised patch with a little less unnecessary changes.

Dave Reid’s picture

Status: Needs review » Fixed

Test bot likes it, and I tested it myself as well. Committed #56 to CVS! Thanks everyone!
http://drupal.org/cvs?commit=452406

Status: Fixed » Closed (fixed)

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

haggins’s picture

Status: Closed (fixed) » Active

I'm using latest dev but still have problems. This is the (tokenized) mail I receive:

To: user2@localhost
Subject: New content from "[author-name]"
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8Bit
X-Mailer: Drupal
From: user@localhost

Author: [author-name]
Title: [title]

As you see none of the tokens haven been replaced with its value. Are there others also having this issue?

edit: only "comment" and "global" token categories have blue background and are working.

haggins’s picture

Status: Active » Closed (fixed)

It's working when I use rules-module instead of triggers.

verta’s picture

subscribing

Also following: #298683: Tokens are not evaluated

http://drupal.org/node/298683 says there is a -dev release to fix this.

spgd01’s picture

I am still have the issue with all the latest releases of token.

i take it back all is working now. Thank you.

portulaca’s picture

Thank you for the fix!

The 2011-Feb-25 dev build works for me now, I tested all of the user tokens on the "profile updated" trigger.