Patch to allow tokens in emails and messages (depends on the token module).
Waldemar - November 27, 2007 - 17:20
| Project: | Actions |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Jump to:
Description
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
| Attachment | Size |
|---|---|
| actions_token.patch | 2.95 KB |

#1
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
#2
anyone to help me on this one?
b.t.w. the non-cck-fields are displayed properly
#3
Anyone??
I have checked everything but the token does not get replaced by the replacement values.
Thanks
#4
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
#5
#6
(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)
<?phpfunction 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
<?phpfunction 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)#7
subscribing
#8
Sub, still active