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.
Self-titled
Comment | File | Size | Author |
---|---|---|---|
#18 | drupal-raw-username-token-734878-18.patch | 5.54 KB | scor |
#16 | drupal-raw-username-token-734878-16.patch | 5.49 KB | Alan D. |
#8 | drupal-raw-username-token-734878-8.patch | 5.28 KB | Alan D. |
#1 | 734878-username-format-token-D7.patch | 689 bytes | Dave Reid |
Comments
Comment #1
Dave ReidSimple patch for review.
Comment #2
Dave ReidComment #3
awmckinley CreditAttribution: awmckinley commentedPatch works great. Made a quick module containing a simple hook_username_alter(), and the change showed up in a pathauto generated URL alias.
Comment #4
dawehnerPatch works fine.
Can someone explain why theme_username does not use format_username to get the name?
Comment #5
webchickStraight-forward fix. Committed to HEAD. Thanks!
Comment #6
dawehnerpreprocess_username users format_username already.
Comment #8
Alan D. CreditAttribution: Alan D. commentedWith this patch, we lose the ability to access the username in user emails, etc.
I would suggest providing the user-raw token that the RealName module provides into core, otherwise every implementation of hook_username_alter() will need to provide their own tokens.
Comment #9
dawehnerMaybe it's not obvious for me, but can you eloberate why?
Comment #10
Alan D. CreditAttribution: Alan D. commentedBecause the token [user:name] uses $account->name run through format_username() that invokes hook_username_alter().
For example, the Name module also implements this. This provides a multi-component name field and unlimited formatting options. We were using this, with the format "First name Surname" and the resulting emails sent using the user email templates were giving "username: Mr John Doe" rather then "username: johndoe"
Comment #11
tstoecklerWe could also have an extra layer of nesting:
[user:name:formatted]
[user:name:raw]
The former would be the default and would be implied when doing [user:name].
What do you guys think?
Comment #12
tim.plunkettFixing tag
Comment #13
hass CreditAttribution: hass commentedLooks like this is the core case for #1827980: Post module enable/disable requirements (README): Account settings - E-mails require manual update, isn't it?
Are we able to get this in and change all username tokens in email templates to name-raw, please?
Comment #14
hass CreditAttribution: hass commented#8: drupal-raw-username-token-734878-8.patch queued for re-testing.
Comment #16
Alan D. CreditAttribution: Alan D. commentedre-roll
Comment #17
Xano16: drupal-raw-username-token-734878-16.patch queued for re-testing.
Comment #18
scor CreditAttribution: scor commentedreroll after a file move.
Comment #19
BerdirLooks good to me and makes sense, but I think we won't be able to get this in without tests...
Optimal case would be a registration test that enables a user name alter module and then check the sent e-mail.
Comment #20
mgiffordThis still a concern in D8? Unassigned issue too.
Comment #21
BerdirPretty sure that #2112679: getUsername() should return the username getDisplayName() for the formatted user name solved this problem.
Comment #22
Alan D. CreditAttribution: Alan D. commentedD8
[user:display-name]
[user:name]
But still broken on D7 and that patch isn't back-portable ;)