We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38800
    • 35 Posts
    I'm running MODX Revolution 2.2.4, and appear to have run into what has been logged as a bug here: http://tracker.modx.com/issues/7281

    It's perfectly possible to manually create a user account with a purely numerical username in the Manager.

    However, when a user attempts to self-register using Login.Register, the username is created OK, and the confirmation e-mail sent. But when the user clicks on the e-mail link to confirm, although they're taken to the right page - which calls the
    [[!ConfirmRegister]]
    snippet - their username isn't activated. Everything works apart from the actual activation of the newly-created numerical username.

    Does anyone know if this issue is being actively looked at by anyone, and - if so - when a fix is likely to be available?

    And, almost more importantly, is there a workaround that will allow me to get it working now? I am working on a project that unfortunately requires purely numerical usernames! [ed. note: wakatashi last edited this post 11 years, 9 months ago.]
      • 51020
      • 670 Posts
      Quote from: wakatashi at Jul 11, 2012, 11:15 PM
      I'm running MODX Revolution 2.2.4, and appear to have run into what has been logged as a bug here: http://tracker.modx.com/issues/7281

      It's perfectly possible to manually create a user account with a purely numerical username in the Manager.

      However, when a user attempts to self-register using Login.Register, the username is created OK, and the confirmation e-mail sent. But when the user clicks on the e-mail link to confirm, although they're taken to the right page - which calls the
      [[!ConfirmRegister]]
      snippet - their username isn't activated. Everything works apart from the actual activation of the newly-created numerical username.

      Does anyone know if this issue is being actively looked at by anyone, and - if so - when a fix is likely to be available?

      And, almost more importantly, is there a workaround that will allow me to get it working now? I am working on a project that unfortunately requires purely numerical usernames!

      I know this is a very old thread, but I have the same issue and wondered if you got it resolved? it seems that three years on, this bug is still there!
        • 38800
        • 35 Posts
        I worked around it by allowing the user to type in a number as their username, but then I prepended a letter "u" on to the front behind the scenes. So, for example, if the user signed up with the username of 00340, the actual MODX username that ended up getting created was u00340.

        And, of course, when displaying usernames to users, it was necessary to strip the leading "u" off again.

        Can't remember the nuts and bolts of exactly how I did it, but that was the general idea! And it did work.
          • 51020
          • 670 Posts
          Quote from: wakatashi at Apr 21, 2016, 04:25 PM
          I worked around it by allowing the user to type in a number as their username, but then I prepended a letter "u" on to the front behind the scenes. So, for example, if the user signed up with the username of 00340, the actual MODX username that ended up getting created was u00340.

          And, of course, when displaying usernames to users, it was necessary to strip the leading "u" off again.

          Can't remember the nuts and bolts of exactly how I did it, but that was the general idea! And it did work.

          You can't remember code from three years ago?? lol

          Yes thanks - I just found this buried within threads:

          if (isset($_POST['registerbtn'])) {
          $_POST['username:required'] = "u".$_POST['username:required'];
          }

          I've got it working - but I can't work out how to :

          A: remove the 'u' from the username in the email which is sent
          B: appends the 'u' to the front of the username when the user tries to login.


            • 51020
            • 670 Posts
            I've managed to add the U on the login page:

            <?php
            if (isset($_POST['Login'])) {
            $_POST['username'] = "u".$_POST['username'];
            }

            So I just need to remove the U from the email which is sent!
              • 51020
              • 670 Posts
              Sorted it - I just added an output modifier to the email tpl:

              [[+username:stripString=`u`]]

                • 38800
                • 35 Posts
                Excellent - cheers!