Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
tips-topic
Wordpress usernames, allowable characters?
Avatar
Bart C.
New Jersey, USA
Member
Free Members
sp_UserOfflineSmall Offline
Oct 15, 2014 - 12:27 pm

Hi folks,

Thought I'd put this question here even though it's a general WordPress question and not specific to SimplePress.

Is it true that WordPress only allows lowercase letters and numbers in usernames?  If so then how do people here have names like "Mr Papa"?  We continue to have gremlins and I'm wondering if our lack of restrictions on our users' names is something that might be contributing to our problems.

Does BuddyPress have different allowances for characters in usernames?

Thanks,

Bart

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 15, 2014 - 12:29 pm

I am actually unaware of any restrictions on WP user names although there are almost certainly some. But absolutely NOT capital lertters

andy-signature.png
YELLOW
SWORDFISH
Avatar
Bart C.
New Jersey, USA
Member
Free Members
sp_UserOfflineSmall Offline
Oct 15, 2014 - 12:47 pm

thanks for the reply Y.S.  i had a user with a space and capital letters in his username do a test for me.  we had only flagged the space in his username as the problem for him so he registered the name but without the space.

strangely enough, the new username (ohioAV8TOR) without the space seemed to activate his old username (ohio AV8TOR) and his account suddenly let loose a stream of PM's and other notifications that were hung up in the system.  It's as if the software associated the bad address with the new address and used it as a validation to dislodge errors with the old address.

there must be something to the usernames issue.  i did find references to username only allowing lowercase and numbers but i've got to run out for a bit.  i'll link to them when i get back.

bart

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 15, 2014 - 2:10 pm

Is this standard wp or multisite? Multisite has, I believe, further restrictions... WP is planning to change that in multisite but no ETA....

Avatar
Bart C.
New Jersey, USA
Member
Free Members
sp_UserOfflineSmall Offline
Oct 15, 2014 - 2:27 pm

Mr Papa said
Is this standard wp or multisite? Multisite has, I believe, further restrictions... WP is planning to change that in multisite but no ETA....

standard wordpress

ClassiPress theme, SP forums

 

Would you mind elaborating on the character restrictions please?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 15, 2014 - 2:52 pm

I think you need to direct that question to WordPress support. Simple:Press accepts whatever username has been created by the WP core. And that user name does include capitals and sopaces - witness my own user name for example.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 15, 2014 - 8:33 pm

andy is right, not a wp issue if something is restricting names... likely a membership or registration plugin... or theme...

but how wp does it:  http://codex.wordpress.org/Fun.....itize_user

Avatar
Bart C.
New Jersey, USA
Member
Free Members
sp_UserOfflineSmall Offline
Oct 16, 2014 - 8:40 am

I saw that function at the wordpress site and another reference to it in the formatting.php file so I went looking for it.  Here it is for reference;

/**
 * Sanitizes a username, stripping out unsafe characters.
 *
 * Removes tags, octets, entities, and if strict is enabled, will only keep
 * alphanumeric, _, space, ., -, @. After sanitizing, it passes the username,
 * raw username (the username in the parameter), and the value of $strict as
 * parameters for the 'sanitize_user' filter.
 *
 * @since 2.0.0
 *
 * @param string $username The username to be sanitized.
 * @param bool $strict If set limits $username to specific characters. Default false.
 * @return string The sanitized username, after passing through filters.
 */
function sanitize_user( $username, $strict = false ) {
    $raw_username = $username;
    $username = wp_strip_all_tags( $username );
    $username = remove_accents( $username );
    // Kill octets
    $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
    $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities

    // If strict, reduce to ASCII for max portability.
    if ( $strict )
        $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );

    $username = trim( $username );
    // Consolidate contiguous whitespace
    $username = preg_replace( '|\s+|', ' ', $username );

    /**
     * Filter a sanitized username string.
     *
     * @since 2.0.1
     *
     * @param string $username     Sanitized username.
     * @param string $raw_username The username prior to sanitization.
     * @param bool   $strict       Whether to limit the sanitization to specific characters. Default false.
     */
    return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
}

I'm not an expert on .php but it looks to me like standard wordpress lets just about any character to be used with WordPress, provided $strict=false.

And, fwiw, i'm posting this here figuring that the people using SP are probably also WP literate and might be able to help.  i'm not necessarily vying for admin help.  the wordpress.org forums are very limited in the help that one can expect to find there so i thought it might be something we could discuss here.  if it isn't appropriate to post these kinds of general WP questions then I won't do so again in the future.

Bart

Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Oct 16, 2014 - 9:58 am

Feel free to post any questions - no matter how far from SP they may be. As you said, maybe someone can shed some light on the situation. Unfortunately not myself! Will have to wait for someone else to take a look here.

Avatar
Bart C.
New Jersey, USA
Member
Free Members
sp_UserOfflineSmall Offline
Oct 16, 2014 - 10:10 am

I just posted this to the ClassiPress forums since it ought to be their responsibility to provide a solution.  If anyone feels like chiming in I'd be happy to find an answer.  Thanks, Bart

 

dealing with similar usernames issue....was going to report a bug

in the formatting.php file I set $strict to True to limit characters that can be used in usernames. using characters other than ., -, and @ throws an error message during the registration process. if you use a space though, the system accepts the new username BUT DELETES THE SPACE WHEN IT RECORDS THE ENTRY!

So if you register using "GSN test user" as your username, it will actually put you into the system as GSNtestuser and when you go to change your password or do something else it won't recognize you if you put in "GSN test user" but you won't know to put in GSNtestuser which is how you have been recorded into the database.

How do we get the system to generate a fault for a username with a space in it?? Is there a way to make it spit out the same error message for a space by listing the space character in the sanitize_usernames subroutine or whatever that little bit of code is called? so far, all i've done there is to change the false to true after $strict.

thanks,
bart

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 649
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 618
Members: 17357
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10123
Posts: 79616