Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Autogenerate or remove username


peterverkooijen
Participant

@peterverkooijen

Thanks for the suggestion r-a-y.

The autogenerated username should behave pretty much as the normal username; it shouldn’t be possible to change the username. The URL to the profile page should stay the same, even if the user decides to change his name – which would be a bit unusual anyway.

Or am I missing some other consequences…?

Next problem to solve is what to do with the username field on the registration form. It should get an autogenerated temporary value, to be replaced by the function on activation, and be hidden from the user. I found this code to generate a random string:

$len = 16;
$base='ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789';
$max=strlen($base)-1;
$activatecode='';
mt_srand((double)microtime()*1000000);
while (strlen($activatecode)<$len+1)
$activatecode.=$base{mt_rand(0,$max)};

echo $activatecode;

To add that as value on the registration form I probably have to hack core file. Moving my attention to rearranging the signup form next…

Skip to toolbar