Support » Alpha/Beta/RC » Email Address as Username Not Shown Properly

  • WordPress supports entering an email address as a username such “john@example.com”.

    However, when logged in to the 3.5 beta 1 admin, I hover over my name in the top right and it says:

    John
    johnexample-com

    The bug of course being that the username is not showing properly and removing the @ and replacing . with – even though @ and . are valid characters for a username.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Is it just displaying wrong there? Or is it everywhere?

    Drew Jaynes

    (@drewapicture)

    Docs Czar

    What you’re seeing isn’t the username, it’s the user_nicename.

    I believe user_nicename is intentionally stripped in this way when the account is created because it is the slug for the author archive, e.g. example.com/author/johnexample-com. I know for a fact this happens in 3.4.2 also.

    I’ve only noticed it in this one location.

    While the “nicename” is appropriate for slugs and urls of course, it is not correct display for this profile section.

    That “name” is wrapped in a span with a class called, “username” so will call it username for now. Will let you know if it shows up incorrectly like this anywhere else on the site (other than URLs of course).

    Drew Jaynes

    (@drewapicture)

    Docs Czar

    So either
    A) the username span class is incorrect, because the field is literally displaying the user_nicename coming from the database.
    B) The span class is correct and the field should be displaying the username.

    Here’s what we have on trunk in wp-includes/admin-bar.php:

    if ( $current_user->display_name !== $current_user->user_nicename )
    		$user_info .= "<span class='username'>{$current_user->user_nicename}</span>";

    Sorry no I understand it’s displaying the “safe” version of the username that’s meant for URLS, as per the code in the admin-bar, this is just a post about getting it to show the username in the proper unescaped format.

    That is for most people who enter a username such as “myusername” it would show “myusername” which is the users username.

    This issue only applies to people who create usernames with periods, @’s and such (which are all valid for usernames) and their usernames are appearing stripped of extra characters.

    Or are you trying to say there is a reason why WordPress would want to show the username stripped in that popup profile. If so can you explain why, since it’s for display and not in the URL?

    Drew Jaynes

    (@drewapicture)

    Docs Czar

    Or are you trying to say there is a reason why WordPress would want to show the username stripped in that popup profile. If so can you explain why, since it’s for display and not in the URL?

    I really don’t know 🙂 and I’ve posted a Trac ticket: https://core.trac.wordpress.org/ticket/22121

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Email Address as Username Not Shown Properly’ is closed to new replies.