WordPress.org

Ready to get started?Download WordPress

Forums

Email Address as Username Not Shown Properly (8 posts)

  1. heavymark
    Member
    Posted 1 year ago #

    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.

  2. Is it just displaying wrong there? Or is it everywhere?

  3. 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.

  4. heavymark
    Member
    Posted 1 year ago #

    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).

  5. 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>";
  6. heavymark
    Member
    Posted 1 year ago #

    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?

  7. 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

  8. heavymark
    Member
    Posted 1 year ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.