Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5175 closed defect (bug) (fixed)

Multisite: Trying to register with capital letters is not possible. Error message doesn't reflect this.

Reported by: r-a-y's profile r-a-y Owned by: r-a-y's profile r-a-y
Milestone: 1.9 Priority: normal
Severity: normal Version: 1.2.4
Component: Members Keywords: has-patch commit
Cc:

Description

In multisite, trying to register with capital letters will throw the following generic error.

Usernames can contain only letters, numbers, ., -, *, and @

Why? Because WP multisite explicitly filters sanitize_user() to lowercase characters in wp-includes/ms-default-filters.php:

add_action( 'sanitize_user', 'strtolower' );

This is a UX bug.

Rather than remove this filter, we should probably patch up our user validation function to check for multisite and check for capital letters. If so, throw up a new error.

Attachments (2)

5175.01.patch (1.1 KB) - added by r-a-y 10 years ago.
5175.02.patch (1.2 KB) - added by r-a-y 10 years ago.
Slightly cleaner patch.

Download all attachments as: .zip

Change History (8)

#1 @r-a-y
10 years ago

  • Keywords has-patch added

Also see #2207.

Last edited 10 years ago by r-a-y (previous) (diff)

@r-a-y
10 years ago

@r-a-y
10 years ago

Slightly cleaner patch.

#2 @boonebgorges
10 years ago

  • Keywords commit added

See also http://core.trac.wordpress.org/ticket/17904

The patch is not the most elegant thing in the world, but then again this problem is the result of the whole username validation process being inelegant, so whatevs :)

#3 @r-a-y
10 years ago

this problem is the result of the whole username validation process being inelegant, so whatevs :)

Agreed. We'll have to pay attention to that WP trac ticket to keep up with the proposed changes.

In the meantime, I'll commit this patch.

#4 @r-a-y
10 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 7382:

Clarify error message for a user attempting to register with capital
letters on a multisite install.

Because WP multisite does not allow a user to register with capital
letters, we need to do an explicit check for capital letters and throw
up a better error message to avoid confusion.

Fixes #5175.

#5 @hnla
10 years ago

Must have missed this when I did the original revision of these error messages - why does MS strlower, why would MS be different from regular installs - in fact it suggests that no underscore allowed yet when I tested allowed characters regular WP says they are usable as does use of '*', tis a little bit confusing :(

In the error message if MS we should match to the other in respect of stating characters allowed?

'Username must be in lowercase characters and only contain '.', '-', '@' '

Or something similar.

Additionally if we're patching up this area, one thing I couldn't figure at the time I made these revisions was what really amounts to a massive UX issue, that of BP taking a space in a username and replacing it with a hyphen, this results or can result in a user being completely foxed when they attempt to login as essentially BP has taken the users name and changed it to something different but not told user ;)

Ideally BP's requirement for hyphenated string for url would be better done at some other point in core when it's required leaving registration formatting to as closely match to WP as possible - failing that we ought to inform user somehow bbut would need some form of JS checking of value entered.

Last edited 10 years ago by hnla (previous) (diff)

#6 @r-a-y
10 years ago

why does MS strlower, why would MS be different from regular installs

It's one of those weird WP things, probably a relic from the old WPMU days that hasn't been looked at until recently. See #WP17904 for more on this.

In the error message if MS we should match to the other in respect of stating characters allowed?

'Username must be in lowercase characters and only contain '.', '-', '@' '

Good catch. I missed this! Will fix this up.

that of BP taking a space in a username and replacing it with a hyphen, this results or can result in a user being completely foxed when they attempt to login as essentially BP has taken the users name and changed it to something different but not told user ;)

Agreed that this is a problem. Check out #4622. The whole problem has to do with single WP allowing spaces in usernames and BP kind of reinforcing that you shouldn't be using spaces, which is causing the whole kerfuffle. Let's keep this discussion in #4622, but you're right that we should fix this up.

Note: See TracTickets for help on using tickets.