I'm running MODX Revolution 2.2.4 with Login 1.8.0, 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 with a numeric username 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.
I'm attempting to work around this by writing code to prepend a lower-case "u" to the chosen numerical username. I have a snippet which runs before the "Register" snippet on the page that contains the registration form, which consists of the following code:
if (isset($_POST['registerbtn'])) {
$_POST['username:required'] = "u".$_POST['username:required'];
}
This works fine, and the whole registration and activation process goes through, so that we end up with a username in the format "u12345" created in the database, where "12345" is the username the user chose.
The difficulty I'm having is in presenting a login form to the user that requires them only to type the numerical portion of the username. Easy enough in theory - I just need to prepend a "u" to whatever they enter as the username. The "PreHooks" feature of the Login snippet looks like it might be the ticket for this, but what I've done doesn't work - I specified a prehook with the following code:
$_POST['username'] = "u".$_POST['username'];
return true;
However, it's as if the prehook wasn't there - I can log in if I include the "u" at the beginning of the username, but not if I omit it.
Can anyone suggest what I might do to make this work, please?