Skip to:
Content
Pages
Categories
Search
Top
Bottom

Allowing users to type in Uppercase letters for the username


  • JordashTalon
    Member

    @jordashtalon

    Hi, is there anyway I can allow people to type in uppercase letters for the username without giving them an error (perhaps force all the letters to lowercase) as well as in logging in forcing all the username login to lowercase.

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

  • danbpfr
    Participant

    @chouf1

    use css text-transform property

    {text-transform:uppercase;} = all the word

    {text-transform:capitalize;} = the first letter of a word


    Gene53
    Participant

    @gene53

    @Chouf1 If I understand correctly, I can insert those 2 CSS properties anywhere in my stylesheet and if someone registers with a username such as JohnDoe, the won’t be an error message?

    Salut,

    Gene


    stwc
    Participant

    @stwc

    I’ve run in to this with importing a userbase to a Buddypress install. WordPress likes login names to be lowercase, with no spaces, and no non-alphanumerics (except, I think for dashes (‘-‘).

    Users can, of course, make their display name anything they like.

    The follow-on problem though, is with @username notifications in BP1.2+, which work on the login name and not the display name, so if a user has the login username johnsmith and the display name John, only @johnsmith will work.

    (I’ve also just recently encountered a problem in that usernames with dashes cause @notifications to fail. That is, if a username is johnsmith, @johnsmith works, but if his username is john-smith @john-smith fails.)


    danbpfr
    Participant

    @chouf1

    CSS is only a solution for display.

    stwc is right.

    Did you read this ?

    https://buddypress.org/forums/topic/bp-fbconnect-usernames-with-foreign-characters#post-25347

    there is, maybe, a solution in the post.: a plugin as below to allow non-ansi character account name

    typcally a good question for @DJPaul i think…. ;-)


    danbpfr
    Participant

    @chouf1


    Chris Houghton
    Participant

    @chris-houghton-2

    Here we go – easier than I thought it would be to fix this.

    Go to bp-core/bp-core-signup.php and find the following line:

    $account_details = bp_core_validate_user_signup( $_POST['signup_username'], $_POST['signup_email'] );

    Add this line directly below it:

    $account_details=strtolower($account_details);

    It just transforms usernames typed in multiple cases in the username field to only lowercase letters.

    avoid hacking the core – you can use the filter

    apply_filters( 'bp_core_validate_user_signup'

    which returns an array of user_name, user_email, errors after bp_core_validate_user_signup fires


    Chris Houghton
    Participant

    @chris-houghton-2

    You’re probably right about that….

    Sorry – I’m still getting to grips with everything PHP and Buddypress – where would you add that filter?

    actually, after looking over the signup – that woudn’t be the correct filter; seems $bp->signup->username = $_POST['signup_username']; is assigned after


    smuda
    Participant

    @smuda

    i would like to add this to my functions.php, anyone know how that would look like?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Allowing users to type in Uppercase letters for the username’ is closed to new replies.
Skip to toolbar