There is a Token display for users at admin/config/people/accounts/display.

Is it meant to customize how [user], [node:author], etc are displayed?

If so, it doesn't work here. The token is always just replaced with the username, no matter how I configure the display.

Comments

dave reid’s picture

Status: Active » Fixed

No, changing the 'Manage display' tab for a user will not affect how usernames are displayed. To change that you'll need something like the Real name module.

Anonymous’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Component: Miscellaneous » Code
Category: support » feature
Status: Fixed » Active

This is not fixed! :) The question still is: User token display - how to operate?

hook_username_alter() replaces every username occurrence. Tokens in contrast are on-demand replacements. hook_username_alter() is limited to pure text. A token could contain HTML, couldn't it?

I'd like to change this to a feature request, to make things work like users would expect them:

Provide a token to display a user profile as defined by the "Token" display mode.

What is the "Token" display mode of profiles good for, if not for this?

dave reid’s picture

Status: Active » Fixed

If you want to customize how specific tokens are presented, then you need to write your own custom implementation of hook_tokens_alter(). There will not and never be a way to do this in the UI because things like [user] and [node:author] are not actually fields.

If you want to alter how user names are presented all throughout the site, then using hook_username_alter() or theme_username is the way to go, which neither of which are dependent on the token system at all.

Anonymous’s picture

You're unbelievable! This is not *fixed* by pointing to alternatives. What is the token display mode of users meant for? Allow the community to discuss, but don't expurgate the issue. If it's not working or non-sense, that display mode is ought to be removed.

However, your hints at other solutions are appreciated!

Anonymous’s picture

Status: Fixed » Active
dave reid’s picture

You do not understand either though. The display mode *cannot* control things like node author nor user name because they are not actually fields. They do control the output of things that are fields.

See http://drupal.org/node/1299662 for why the 'Token' display mode actually exists.

ultrabob’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)