• Resolved Erfan MHDi

    (@erfanmhd)


    Hello,

    i have a problem with Username Value when it contains UpperCase Letters.

    when i try to change email or first or last name of a user registered with “JohnDoe” username (UpperCase Letter). i get this error on UM Account Page : “Your username is invalid”

    but if i register a user with “johndoe” (LowerCase Letter) i can simply change first or last name or email address without any problem.

    could guys give me a hint on how can i fix the error in case user has registered a username with uppercase letters ?

    P.S: Ultimate member convert all Uppercase letters in username or email address fields to lowercase before saving to database right?

    Thanks.

    • This topic was modified 1 month, 2 weeks ago by Erfan MHDi.
    • This topic was modified 1 month, 2 weeks ago by Erfan MHDi.
    • This topic was modified 1 month, 2 weeks ago by Erfan MHDi.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @erfanmhd

    How did you enable the username in the Account form? Are you using any UM hooks to customize it?

    Regards,

    Thread Starter Erfan MHDi

    (@erfanmhd)

    hello,

    i didn’t customize it,
    the field is just there by itself i guess, wrapped in #um_field_general_user_login div but the input is disabled.

    im using General form on Account Page: [ultimatemember_account tab=general]

    Regards.

    missveronica

    (@missveronicatv)

    @erfanmhd

    At Registration the ‘user_login’ field is validated with ‘strtolower’ characters but saved with uppercase characters.

    At the Account page the ‘user_login’ field is validated without ‘strtolower’ characters but posted by the form setup as hidden non-changeable uppercase characters.

    You can try to update the UM core file: /includes/core/um-actions-account.php
    at line 98, add the ‘strtolower’ function like this:

    if ( ! empty( $_POST['user_login'] ) && ! validate_username( strtolower( $_POST['user_login'] ) ) ) {

    and test if your “JohnDoe” now can change his First name and Last name or e-mail address at your Account page.

    Thread Starter Erfan MHDi

    (@erfanmhd)

    Hi,
    Thanks, adding strtolower to line 98 works.
    but how can i update proof it ?
    is there any hook or any way i can add “strtolower” validation inside my theme so when i update UM plugin this will still works?

    • This reply was modified 1 month, 1 week ago by Erfan MHDi.
    missveronica

    (@missveronicatv)

    @erfanmhd

    Make a test user and verify if this fixes your issue.

    missveronica

    (@missveronicatv)

    @erfanmhd

    I suspect this to be an UM bug.

    Seconds ago another bug was reported about string validation issues
    might be true for you also i will look at the regex reported bad.

    https://github.com/ultimatemember/ultimatemember/issues/854

    Thread Starter Erfan MHDi

    (@erfanmhd)

    Make a test user and verify if this fixes your issue.

    yup, Both “JohnDoe” and “johndoe” can now update first and last name in account page.

    i didn’t know about the regex problem on custom “user_login” validation.
    but i’ve noticed this a while ago (2 years ago i think) and reported it here but i got no answer so i bring it up again.

    it seems that adding strtolower validation to the core file you mentioned fixes the problem, so should we expect this to be added to UM next update or we have to create an override for it ?

    Thanks !

    missveronica

    (@missveronicatv)

    @erfanmhd

    Very good!!

    Yes to me it seems to be an UM bug and I will make a GitHub UM bug report now.

    Your testing will be my reference for this UM bug and the UM developers must do their job now to fix this issue.

    I will do a code snippet for a second validation of the ‘user_login’ field after the current UM validation code so you can reset the line 98 to original tomorrow.

    Thread Starter Erfan MHDi

    (@erfanmhd)

    Perfect!
    Thanks, looking forward to hear from you tomorrow. 👍

    missveronica

    (@missveronicatv)

    @erfanmhd

    i didn’t know about the regex problem on custom “user_login” validation.
    but i’ve noticed this a while ago (2 years ago i think) and reported it here but i got no answer so i bring it up again.

    This bug reported now is related to all versions after the UM 2.1.18 update.

    missveronica

    (@missveronicatv)

    missveronica

    (@missveronicatv)

    @erfanmhd

    Added now the code snippet workaround to the GitHub UM bug report:

    https://github.com/ultimatemember/ultimatemember/issues/855

    Remove the current “line 98 fix” and test the code snippet if both your “JohnDoe” accounts still are possible to do their name updates.

    Thread Starter Erfan MHDi

    (@erfanmhd)

    the workaround you published is working perfectly 😉
    Thanks for your time!

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.