Force Lowercase Username – WP Signup / Register

During signup / registration if a person types in a Capital Letter or a Period or Underscore (etc.) the form validation kicks in.

How do I prevent this validation error from triggering? Is there a copy / paste function or J$ that I can use to convert uppercase to lowercase, periods to be ignored keystrokes and so forth?

  • Anang
    • New Recruit

    Hi @webmaster

    Thanks for contacting us :slight_smile:

    I want to clarify your question first :slight_smile: Why do you want to force lower case and other characters when you want to remove limitation ??

    Btw, it’s possible to force username to lower case and also limiting from other character with jquery :slight_smile:

    So could you please explain me do you want the validation remove or not ?

    Best Regards

  • Webmaster
    • Flash Drive

    Excellent question @Anang – please excuse my confusion, I’ve been cruising for a bruisin’.

    I’m looking for a solution that guarantees the validation error will NEVER trigger. The J$ snippet sounds marvelous! If some dude types “WPMU” then it’s automatically converted into “wpmu”.

  • Anang
    • New Recruit

    Hi @webmaster

    Put this jquery code on your theme’s footer.php before </body>

    jQuery(document).ready(function(e){
    jQuery("#user_name").keyup(function(e){
    var xstr=jQuery(this).val().replace(/W/g, '')
    xstr=xstr.toLowerCase();
    jQuery(this).val(xstr);
    });
    });

    Let me know the result :slight_smile:

    Best Regards

  • Webmaster
    • Flash Drive

    If it’s not to much to ask, may you please update that snippet to exclude the underscore symbol too?

    I found a detailed-orientated bug, when I “shift + home” the text is unable to be highlighted, however, I can still double mouse click and highlight. No big deal, just sayin’… lol

    Every other symbol is wiped out and eliminated – perfect!

    p.s. – thanks for the wicked share.

  • Anang
    • New Recruit

    Hi @webmaster

    Sorry for late reply.. Here’s the code to eliminate underscore, just replace the code :slight_smile:

    jQuery("#user_name").keyup(function(e){
    var xstr=jQuery(this).val().replace(/W/g, '')
    xstr=xstr.replace('_','');
    xstr=xstr.toLowerCase();
    jQuery(this).val(xstr);
    });

    Let me know if that’s worked on you :slight_smile:

    Best Regards

  • Anang
    • New Recruit

    yeah, I watch it too.. And prefer the series than the Movies :smiley: Although my name is close to Aang, I only can bend the code indent and outdent LOL

    Let me know if you need anything else :slight_smile:

    Best Regards

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.