In a follow up of issue 2888695, wouldn't it be better to use getAccountName() instead of getDisplayName()?
We were using a hook_user_format_name_alter() in our custom code to change how the username is displayed but we couldn't login with the email address anymore since the getDisplayName() change as mentioned in the related issue. I changed this to getAccountName() and now I can login with the email address again. Or is there a reason not to use getAccountName()? I can provide a patch if needed but I just want to be sure if changing this is still correct.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | fbl-use-getacountname-instead-of-getdisplayname-3285369-2.patch | 533 bytes | rgeerolf |
Comments
Comment #2
rgeerolfComment #3
rgeerolfComment #4
geoanders commentedWill review, but I think getAccountName() probably makes more sense. If both cases are needed, we might need to make a configurable option to switch between the two.
Comment #5
geoanders commentedLooks like getDisplayName() does call getAccountName().
In this particular method, it's also running any user_format_name alters found. Which I think makes sense.
I would try disabling the name alter and see if it works without it first.
For reference:
Comment #7
geoanders commentedAdded configuration item that will allow the user to select source for user email/name. By default it will use display name, but you can set it to use account name instead if need be.
See commit above or latest changes in dev branch.
Comment #8
geoanders commentedComment #9
rgeerolfGreat, works for me, thanks!