Closed (duplicate)
Project:
Token
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Jan 2011 at 21:02 UTC
Updated:
14 Feb 2011 at 23:16 UTC
Jump to comment: Most recent
Comments
Comment #1
dave reidThere is not currently any [user:roles] token. Suggestions as to what output that token should generate are welcome.
Comment #2
hass commentedThank you very much for quick feedback. I suggest a comma separated list of all roles a user is a member of. The data should already be in the
$userobject... :-)Comment #3
hass commented@Dave: For now I have created a googleanalytics.tokens.inc and added [user:roles] how I need it. I hope this will not cause collisions if it will be added in a different way.
The missing D7 tokens docs need some *LOVE*... trial and error only :-(
Comment #4
dave reidToken API docs are already provided by core, and several core modules implement them, showing how to do it...
Comment #5
dave reidhttp://api.drupal.org/api/search/7/token
Comment #6
hass commentedWell, but than you need to expect an API change first... I was pretty lost with the documentation links at http://drupal.org/handbook/modules/token and http://drupal.org/handbook/modules/token/update/6/7. None of these docs tells me something about the changed API and how it was changed (upgrade docs). Core modules have been helpful, but the documentation links above need love and/or more pointers. My DX was bad, sorry. :-)
Comment #7
hass commentedChanging title
Comment #8
dave reidFYI this was originally won't fixed with #162502: Token for user roles
Comment #9
hass commentedWhen I implemented [roles] i thought it may be not the best name... well, I may need to change the placeholder name.
Comment #10
hass commentedI decided to change the names in GA to:
[current-user:role-names]
[current-user:role-ids]
[user:role-names]
[user:role-ids]
I wish I could have been able to use [current-user:role:names], but this seems not working if there is no [current-user:role] or at least I was not able to get it working.
Comment #11
dave reidI am getting close to add this by way of #1047740: Add an [array:*] token type and a [user:roles] token where the tokens you would want are [current-user/user:roles] would output 'authenticated user, administrator' and [current-user/user:roles:keys] would output '2, 3'.
Comment #12
dave reidOfficially merging this issue into #1047740: Add an [array:*] token type and a [user:roles] token since the [user:roles] token provides a good basic use case for the array token type.
Comment #13
liquidcms commentedtoo bad not a role token that doesn't included authenticated user; since that role is rarely ever useful to state.