Closed (fixed)
Project:
Token
Version:
6.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Oct 2010 at 18:32 UTC
Updated:
3 Jan 2014 at 02:04 UTC
Jump to comment: Most recent, Most recent file
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 commentedsubscribe
Comment #3
fagoComment #4
fagoOuch, the token module changed....
Comment #5
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 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 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 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 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 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 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 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
barrapontoplease fago, would you be so kind as to provide a patch for this?
Comment #17
nadavoid commentedsubscribing
Comment #18
danny englanderI realize now I was experiencing this same issue here: http://drupal.org/node/1045516
Comment #19
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 commentedsubscribing
Comment #22
auth commentedAttached patch based on #14 with feedback from #15.
Comment #23
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 commentedExperienced issue with tokens not being replaced in text comparision. Refactored patch and included comment in #23 to handle this.Comment #25
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 commentedGlobal tokens seem to be working, thanks for the patch.
Comment #27
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 commentedCould you please test your use case against this updated patch?
Comment #29
timd.mackey commentedWoo-hoo, #28 works! Thanks for the new patch.
Comment #30
dkingofpa commented#28 is working for me as well. Thanks auth.
Comment #31
havran commented#28 Working for me. Thanks.
Comment #32
danny englander#28 works!!
Comment #33
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