Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: [Buddypress] Capital letters in Usernames


techguy
Participant

@crashutah

@Tolden and @stephenefromfrance
Your functions.php file should contain the folowing:
`<?php
//Deals with uppercase username signup problems…maybe
function my_sanitize_user( $username, $raw_username, $strict ) {
$username = $raw_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 );

// Consolidate contiguous whitespace
$username = preg_replace( ‘|s+|’, ‘ ‘, $username );

return $username;
}
add_filter( ‘sanitize_user’, ‘my_sanitize_user’, 100, 3 );

?>`

At least that’s what mine has and it works fine.

I’m also using this plugin to notify users if this would be a problem for them also: http://buddydev.com/buddypress/creating-a-buddypress-wordpress-username-availability-checker-for-your-site/ Although, I think I modified the script so it would only warn for certain use cases. I also did just realize that it doesn’t work for IE. Haven’t had a chance to see why yet. So, it’s good that I have both.

Skip to toolbar