I'm new to tokens, but they look awesome. I'm trying to send a tokenized email as an action after content is updated. It sends the email, but all of my tokens appear without being rendered. For instance the email I receive is:
The following work order has been requested via the website:
[field_wor_id_maintenance-raw] requested by [author-name] [body] View this
online here: [url]
I have three problems, one is obviously the tokens, the second is my line breaks are missing. Third is I can't find a token listed for the body of the node, is [body] one or is there no way to include the body? Help! What am I doing wrong?
Thanks,
CindyR
Comments
Comment #1
cindyr CreditAttribution: cindyr commentedcorrecting the title
Comment #2
ifoundthetao CreditAttribution: ifoundthetao commentedI too am having this problem.
I'm using Views, CCK rc-9, Tokens, Trigger is enabled, and Rules too.
Drupal version 6.4
Comment #3
robertDouglass CreditAttribution: robertDouglass commentedConfirmed the problem when creating a tokenized redirect action. [uid] renders as [uid], not as the user id. Marking as critical since this is the module's core functionality.
Comment #4
greggles@robertDouglass - thanks for confirming the bug. In terms of maintenance on this module, Eaton wrote it. I don't use it and barely understand it. So, if you want a fix you're probably going to have to provide something that I can review.
Comment #5
ifoundthetao CreditAttribution: ifoundthetao commentedI really know NOTHING about programming modules in Drupal, however, I do know PHP and MySQL, so from my investigating I have come up with several things..
token_node.inc
line 20
$type = "recipient"
$object = recipient's email address
So, I think we can add another case in here for 'recipient' and do the db_queries to get the info we need.
I could be wrong though. Let me know if that's OK or if it is flawed.
Comment #6
greggles@ifoundthetao - the uid token comes from token_user.inc.
Comment #7
ifoundthetao CreditAttribution: ifoundthetao commentedActually, I copied those lines of code directly from token_node.inc ..
I got it working for me..
But this is what I did..
OK, so, if you don't know how to program in PHP or with MySQL, this might be a bit confusing...
But I just set up another "case" which I put in after the original case for "node" ended..
then I got the user variables, checked for the users latest updated node.
It does this by checking the node table, and then it gets the NID and then I go to the table that I need my data from, in this case content_type_ticket, and gets the data from the rows.
So if you want to update it to work for you specifically..
Just change the table that you want to get your data from, edit the fields to be what data you want, and then make your own token.
It might not be pretty, but it works for me.
Comment #8
idflorin CreditAttribution: idflorin commentedcould someone wright a patch ?
Comment #9
nickgs CreditAttribution: nickgs commentedIs there a token for the body of the node?? I don't seem to see it either?
Thanks.
Nick
Comment #10
gregglesThere is no token for the node body. Token (in it's current incarnation) has to very carefully balance the desire for tokens with the speed of generating the token. Maybe that will change with a token "2.x" whenever it is released.
Comment #11
nickgs CreditAttribution: nickgs commentedInteresting. I have found a simple solution here:
http://drupal.org/node/335608
Thanks.
Nick
Comment #12
Dave ReidComment #13
Dave ReidThis 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.
Comment #14
Dave ReidClosed due to lack of feedback.