Niko
  • Administrator

      Reputation : 319
      Registered on : 2012-02-22
      Posts : 2366
      School of codes courses: coming soon
    Avoid numbers in nicknames

    Description


    When the person registers on your forum, choosing her/his nickname, if it wants to put a number after/before it there is an alert message :bene:

    Thanks to Etana

    Set up


    Simply, add this Javascript code on all pages:
    Code:
    <!--- Subject: "Avoid numbers in nicknames" - Copyright 2012 by www.fmcodes.com. All Rights Reserved. Use and/or modification of this script is allowed, provided this entire copyright notice remains in the original or modified code. Distribution is not allowed without written consent from FMCodes--->
    // Test on the page of registering
    "/register" == location.pathname && "?agreed=true&step=2" == location.search && $(function() {
      // Test that the nickname field is completed
      $("input#username_reg").length && $("#ucp").submit(function() {
        // Test on send action
        if($("input#username_reg").val().match(/[0-9]/)) {
          // If there are numbers get back and alert
          return alert("Attention: Numbers inside of your nickname are not allowed. Try another nickname "+$("input#username_reg").val()+" )"), !1
        }
      })
    });

    Customize the tutorial


    You can change: Attention: Numbers inside of your nickname are not allowed. Try another nickname with your own alert message

    Technical problems


    The tutorial was tested on this forum and with the browser Google Chrome; If you notice that the tutorial doesn't work for a browser or for a version of forum (PhpBB2, PhpBB3, PunBB, Invision) contact an administrator and we will fill this field with your reporting.

    Thanks, the staff
    For every problem or question please, contact us in the section Support for the tutorials, The staff will answer you as soon as it is possible...

    Friendly,
    The team of the Forum of Codes.



    Niko wants you in the team Guest

    Community manager and Administrator at Forumattivo.com

    Nathan
    • Veteran staff member

        Reputation : 7
        Registered on : 2012-06-26
        Posts : 108
      ow numbers? ow lol..