Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] period or special characters in username


  • alpha2
    Participant

    @neoseeyou

    Hello everybody

    I launch a social site 2 days ago and luckily i have lots of users already but i have an issue

    Some users registers with a period on their username : john.doe or in some small case with their complete email address 😉

    I have 2 questions:

    – Is it possible as admin to change their username in the back office?
    – Why the dot/period or special characters are allow in the username during the registration? and how i can block this?

    Thank you

Viewing 9 replies - 1 through 9 (of 9 total)

  • shanebp
    Moderator

    @shanebp

    – Is it possible as admin to change their username in the back office?

    No, WordPress does not allow it. Usernames must be unique.

    – Why the dot/period or special characters are allow in the username during the registration? and how i can block this?

    There are various methods to restrict the characters allowed in a username when registering. Here’s one example:
    http://wordpress.stackexchange.com/questions/124697/limit-username-to-specific-characters-a-z-and-0-9


    alpha2
    Participant

    @neoseeyou

    I have found an answer for my second question: i use the plugin restrict usernames. Work great


    alpha2
    Participant

    @neoseeyou

    Thank you @shanebp for this link.

    So for few users who enter as username their email address, what can i do?

    Thank


    shanebp
    Moderator

    @shanebp

    The link I shared above only allows letters and numbers.
    So dots and @ symbols will be rejected.
    Did you review the answer in that link?
    Did you try it?


    alpha2
    Participant

    @neoseeyou

    i didn’t try the answer in that link because i find the previous plugin before i view your answer.

    Maybe it’s better to use a simple function that a plugin 😉


    Henry Wright
    Moderator

    @henrywright

    The Restrict Usernames plugin is pretty cool actually. I’ve used it in the past. Aside from specifying illegal characters, it will let you reserve words you don’t want normal users to register. Site name, admin, help, support all spring to mind.


    alpha2
    Participant

    @neoseeyou

    Yes it is. But rather than using a plugin (for this project i am nearly at 53 active plugins…too much) maybe its better to use a function.
    i use this thread to ask you another question, some users (registered before i applied this plugin) named their account with a period: john.doe . Actually it’s not a big deal because buddypress (or wordpress natively) transform this dot into hyphen in each link.

    On one specific page template, I have special function i created with the help of a dev to display all users by a custom taxonomy (ranks)

    Only mater is that every hyperlink that link to account like john.doe are display like this http://www.website.com/members/john.doe and not http://www.website.com/members/john-doe

    I search into the code and found this:

    <div><?php $user = get_user_by('id', $gold ); ?><a href="<?php echo site_url();?>/members/<?php echo $user->user_login;?>/buddyblog/"><?php echo bp_core_fetch_avatar( array( 'item_id' => $gold, 'type' => 'full' ) ); ?></a><a href="<?php echo site_url();?>/members/<?php echo $user->user_login;?>/buddyblog/"><?php echo $user->user_login; ?></a>Performances: <?php echo count_user_posts( $gold ); ?></div>

    I must change how is display the username.

    Thank you for your time and your help!


    Henry Wright
    Moderator

    @henrywright

    I think you might find it is the user_login property has the value john.doe. I can’t remember where the hyphenated username is stored but try user_nicename instead.


    alpha2
    Participant

    @neoseeyou

    of course! as simple as that. Thank you @henrywright !

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] period or special characters in username’ is closed to new replies.
Skip to toolbar