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.
Is there a token that will not use the altered version of the theme_username? I didn't see anything. Seems like if a username is altered, there are many situations where you might want to still use the original value of the username. Is there a way around this?
Comments
Comment #1
Rob230 CreditAttribution: Rob230 commentedThis seems like quite an oversight. I encountered it when I had used hook_username_alter. This is because theme_username uses template_preprocess_username, which calls format_username, which calls hook_username_alter.
That all makes sense from the point of view of anywhere that the username is displayed to the user, and I can understand why you'd want that to be the case for the username token for the majority of situations. But there should be a way to access the raw username as a token.
The use case I stumbled upon was in welcome emails and forgotten password emails. By default they tell the user what the username to log in with is, but because I had used hook_username_alter it wasn't putting the raw username in the email and there is no token for it. The same would be true if you overrode theme_username.
I imagine similar problems could happen with webform if you wanted to have the raw username as a hidden field, but instead you'd get the themed one, which might not be what you want saved.
There needs to be a way to access the raw username as well as the themed/formatted one. I don't know if that is an issue for Token or Drupal core.
Comment #2
tahiticlic CreditAttribution: tahiticlic commentedAny idea on how to achieve this ? Same need for me (and here too : https://drupal.org/node/2046607)