Closed (outdated)
Project:
Token
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Jun 2011 at 15:21 UTC
Updated:
24 Apr 2024 at 18:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidHow would you expect the token to work? Maybe seeing some sample output of the token would help.
Comment #2
thekk commentedI have the same use case, but with Drupal 6.x. I've created the attached module to create a tokenvalue for ['user']['logged-in'].
Doing this in token_user.inc would require a 2 line patch.
Comment #3
gregglesThanks for your comment and for helping make this a better module. Could you provide this as a patch?
Comment #4
thekk commentedFirst time with tortoisegit, here's to hoping it works.
Again: I've done my work on the 6.x branch, I haven't looked into 7.x
Comment #5
gregglesLooks like a good start. When you upload a patch be sure to set the status to "needs review" so others can find it.
I'm marking it "needs work" because it seems you used a tab for indentation rather than spaces.
I'm not sure whether the use of t() makes sense here. For my purposes it is to track users in google analytics so having different variable values for each user language wouldn't be desired. Perhaps we need two tokens, one that shows a text representation like you have and one that returns a 0 for anonymous and a 1 for authenticated. Thoughts?
Comment #6
thekk commentedI agree that the use of t() doesn't really have purpose. I've scrapped it in the attached patch, as well as change the tabs to spaces.
I don't see much benefit (in google analytics), because most users would just have to think harder: does the '1' represent logged in or anonymous? Perhaps TRUE and FALSE? Do you have a usecase where you need the binary approach? But perhaps that's something for a different issue?
Comment #7
thekk commentedIt would be appreciated if someone could take a look at this...
Comment #8
dbassendine commented+1 - I've tested this patch and it works well. I'm using it for a Google Analytics custom variable.
Comment #9
Chris Charlton+1 for this token. I know it's an oldie but it's a goodie.
Comment #10
gregglesThe patch in #6 looks close, but the spacing is still off.
@Chris Charlton - did you test out the patch? Does it meet your expectations from a functional perspective?
Comment #11
bluegeek9 commented