I had to do this for my purposes and thought that people might be interested in this as well.

Thanks for the great module!

Waldemar

CommentFileSizeAuthor
actions_token.patch2.95 KBWaldemar

Comments

clivesj’s picture

Thank You.
I have applied the patch and now the "replacement pattern" link is showing beautifully on the email-action page. When I click the link I get all the avaible tokens.

When I insert the tokens in the emails however, the valuas are not transmitted to the email. So:

In the email-template i put: name=[field_myname_raw]
When i receive the mail it shows: name=[field_myname_raw] iso name:John Doe

Do I have to do anything additionally to get it working?
Thanks

clivesj’s picture

anyone to help me on this one?

b.t.w. the non-cck-fields are displayed properly

clivesj’s picture

Anyone??

I have checked everything but the token does not get replaced by the replacement values.

Thanks

clivesj’s picture

Sorry, my problem was self-induced. I was using cck-field that weren't used in de content-type
The patch works perfectly
Sorry for any inconvenience

mlncn’s picture

Status: Needs review » Reviewed & tested by the community
pete-drupal’s picture

(Not sure where this comment belongs. It proposes a patch to token.module, but as a direct consequence of the patch actions_token.patch described in this post)

I use Drupal 5.7, workflow 5.x-1.2, actions 5.x-1.0 and token 5.x-1.11 in order to send emails on certain workflow transitions. The mail should contain the name of the new state (i.e. after transition).

The actions_token.patch described in #195773: Patch to allow tokens in emails and messages (depends on the token module). is working fine, except that on a state transition, the token [workflow-current-state-name] shows the old state instead of the new state.

The cause seems to be that the token values are determined and cached before the state transition occurs. After the transition, the token value is retrieved from the cache instead of re-determined.

A workaround consists in replacing (in token.module)

function token_replace($original, $type = 'global', $object = NULL, $leading = '[', $trailing = ']', $options = array()) {
  $full = token_get_values($type, $object, FALSE, $options);
  return _token_replace_tokens($original, $full->tokens, $full->values, $leading, $trailing);
}

with

function token_replace($original, $type = 'global', $object = NULL, $leading = '[', $trailing = ']', $options = array()) {
  $full = token_get_values($type, $object, TRUE, $options);
  return _token_replace_tokens($original, $full->tokens, $full->values, $leading, $trailing);
}

(token_get_values($type, $object, FALSE, $options);
is changed to token_get_values($type, $object, TRUE, $options); to disable token caching altogether - which makes it probably a less than ideal solution)

socialnicheguru’s picture

subscribing

guillaumeduveau’s picture

Sub, still active

pomliane’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

This version of Actions is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.