yes but i think it's only necessary to differentiate the username with a prefix at all when both the display name and the username are shown at the same time.
I’m going to disagree until the day I die on that. I see huge value in consistency. So presenting the username of user A differently than user B is never going to be a good option, imo. I mean unless you want to go back to the MySpace days and the cluster**** those profiles were.
I'd say pick a way to treat usernames and stick with that for all users, same for display names. If that "consistency" is simply applying nothing to both usernames and display names, that's certainly something you can do. Maybe the solution is to leave usernames "as-is" and just have a prefix for display names? That's going to be much cleaner and consistent for those that don't like change.
Personally that feels very confusing to me though. Imagining if I was a user of a site and some usernames are one way and just look like display names (nothing to show what's an actual username or not) and without being a power user and knowing to go dig through their profile, it gets confusing on how to address them in my mind (either within a message or even just sending a direct message). Like maybe I see them mostly as their display name... which now looks the same as most user's username if they don't have a display name set.
That being said, I'm certainly not the boss of your site, so if you want to present usernames differently depending on the user and/or if they have a display name set, you could do that if you really wanted to I suppose.
For example if I'm displaying recently online users in a widget then the display name they've chosen to use should be used - that's why they've set it, after all. If they have no display name set then show their username - there's no need to put an @ before it.
That’s how it works depending on how the widget was built. If something uses the <xf:username> tag with an overridden username (specifically it sets the
defaultname
attribute, it will respect that and keep whatever the override is). Widgets tend to do that because internally they are passing objects that aren't actually users. The "username" in those cases come from things like the thread table (latest poster). For that reason, they specifically set an override for the "username" without having the actual user entity. There's not a realistic way to automatically correct that without adding a ton of queries (every time something uses the override, then query the user table to see if there's a username that matches, etc.) it would also cause issues doing it that way.
TL;DR: basically when something uses the username override for the <xf:username> tag, that override is going to be left alone (it's an "override" already).
Which reminds me - the @ prefix doesn't seem to be getting applied to usernames in some widgets (New threads & Trending content for example)
The same basic reason as above... when something uses the username override, we don't touch it (and we also don't know if it's the
actual username or not since the user entity isn't passed in.