Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For example, would be good to have a token for site name in the subject line, sg like welcome to [sitename]
Comments
Comment #1
klausiI remember that was possible as the site-wide tokens were always added to the tokens of any variable. Now they are gone, so this is a valid bug report. Something must have changed in token.module
Comment #2
bsztreha CreditAttribution: bsztreha commentedsubscribe
Comment #3
fagoComment #4
fagoOuch, the token module changed....
Comment #5
malks CreditAttribution: malks commentedDoes this mean that this won't get fixed until the token module is fixed?
Comment #6
fagoNo, we'll have to roll a patch for the token module - as its rules integration lives there.
Comment #7
malks CreditAttribution: malks commentedIs there an issue in the token queue for this then? I'm going to just write my own action I think to get around my particular use case, but happy to try and get a patch going against token if that helps.
Comment #8
malks CreditAttribution: malks commentedI'm trying to work through this and rules being such a complex module I'm having to muddle at the best. What I'm finding though is that isn't it best to have responsibility for the global tokens in Rules? That is, shouldn't rules always load in global tokens as a variable/argument? Does this sound on the right direction or am I missing something.
Malks.
Comment #9
ionmedia CreditAttribution: ionmedia commentedi have global section in tokens for another modules
CCK cck_phone
CCK content_taxonomy
CCK date
CCK file
CCK gmaps address
CCK gmaps point
CCK link
CCK node reference
CCK number
CCK serial
CCK text
CCK vinfield
Global
Node
thats from /admin/build/path/patterns
maybe for a rule it was able to build such list:
user1
--....
user2
--....
Global
--site-name
--date
--...
Node
--....
--CCK number
----....
--CCK serial
--CCK text
--.....
now i use rules 6.x-1.3 and there is no global tokens, how can i use site-name ?
Comment #10
apmsooner CreditAttribution: apmsooner commentedI have both the latest versions of rules and token and had an original token used in a rule of [node:site-name] and it still works so it seems the tokens still function but just not visible in the rules interface right?
Comment #11
malks CreditAttribution: malks commentedI think if you have a rule (or rule set) that has arguments, in apmsooner's case a node, then the global tokens get loaded against that so [node:site-name] will work (I suspect that [global:site-name] won't work), but if there are no arguments (as in the case of scheduled rule sets) then you will not be able to get to them.
Comment #12
drupaljaipur CreditAttribution: drupaljaipur commentedused token-6.x-1.15 module
changes done in token.rules.inc file to make global tokens available in rules action.
Govind
Comment #13
fagoPatches again the token module should be posted into the token issue queue.
The patch contains some random line changes and introduces some trailing white-spaces, as well as commented out code. Take care of that. Be sure to follow the drupal coding standards.
We need to use a var-name that may not occur else (e.g. :global) + we need to really identify whether a global token has been used at all and only then run the global token replacements.
Comment #14
drupaljaipur CreditAttribution: drupaljaipur commentedThanks for the advise fago. I tried to follow it.
I couldn't understand what you mean by "use a var-name that may not occur else (e.g. :global)" but tried to identify whether global token is being used and then only run the global token replacement.
Comment #15
fagoSo there is
and below
So is global now in the used vars or not? Anyway, the approach token of the token integration *scans* for token usage in preparation, so the above strpos() shouldn't be necessary at run-time. That said, global should be in the used-vars. However, there might be rules variable of name 'global' what would lead to conflicts. Thus, use ':global' inside $used_vars to avoid conflicts (+ document that with a comment).
Watch out for the coding standards! (indention, spacing)
Also, we could make use of the new token treewidget for the token help, but that's another issue.
Comment #16
barraponto CreditAttribution: barraponto commentedplease fago, would you be so kind as to provide a patch for this?
Comment #17
nadavoid CreditAttribution: nadavoid commentedsubscribing
Comment #18
Danny EnglanderI realize now I was experiencing this same issue here: http://drupal.org/node/1045516
Comment #19
chrislabeard CreditAttribution: chrislabeard commentedNothing since Feb? How people living without global tokens?
Comment #20
Dave Reid@chrislabeard: Feel free to learn the patching process and make the modifications suggested in #15 to the patch in #14.
Comment #21
pbeakley CreditAttribution: pbeakley commentedsubscribing
Comment #22
auth CreditAttribution: auth commentedAttached patch based on #14 with feedback from #15.
Comment #23
nadavoid CreditAttribution: nadavoid commentedSpot checked #22, using [:global:site-date-month] and [:global:site-name], which will be great for sending emails.
Attaching an updated patch, only adding a comment, about the leading ":" in ":global"
Comment #24
auth CreditAttribution: auth commentedExperienced issue with tokens not being replaced in text comparision. Refactored patch and included comment in #23 to handle this.Comment #25
auth CreditAttribution: auth commentedAttached wrong file in #24, attaching correct file.
Experienced issue with tokens not being replaced in text comparision. Refactored patch and included comment in #23 to handle this.
Comment #26
timd.mackey CreditAttribution: timd.mackey commentedGlobal tokens seem to be working, thanks for the patch.
Comment #27
timd.mackey CreditAttribution: timd.mackey commentedHmm, while global tokens are working now, it appears that this has caused problems with the
user:
andaccount:
tokens. I'm using the account: token within a Rule that sends an email to a particular user, however the account: token (which should be the specific registered user) is instead being translated as the user: token (the acting user/administrator). I.E. - If I have a Rule which sends a user a one-time-login link to their account, instead they receive an email with a one-time-login for the administrator's account--big problem. I'm pretty sure this is caused somehow by the patch, because after I rolled back the patch, the account: token took the correct value again.Comment #28
auth CreditAttribution: auth commentedCould you please test your use case against this updated patch?
Comment #29
timd.mackey CreditAttribution: timd.mackey commentedWoo-hoo, #28 works! Thanks for the new patch.
Comment #30
dkingofpa CreditAttribution: dkingofpa commented#28 is working for me as well. Thanks auth.
Comment #31
havran CreditAttribution: havran commented#28 Working for me. Thanks.
Comment #32
Danny Englander#28 works!!
Comment #33
timd.mackey CreditAttribution: timd.mackey commentedI'd say this qualifies as #28 being Reviewed and Tested.
Comment #34
Dave ReidCommitted #28 to 6.x-1.x. Thanks everyone for patching and testing!
http://drupalcode.org/project/token.git/commit/43e1993