All major websites out there, while Signing-up, they validate the given username and if it is already used they suggest available Usernames (“related” to the one you initially given) Given: “Tasos” (Exists in database) Suggestions: “Tasos1973” , “Tasoss”, “Tasos1”, etc (Do not exist in database)
I would like to know how would you build that “Username suggestions” part of Sign-up.
(I work on php but doesn’t really matter, I just need to see the workaround and go from there)
Perhaps a check for year of birth or first / last name addition or just a 3digit random number addition.
But as far as my knowledge goes I suppose that there has to be an array of possible suggestions and a loop of validating them so i have the final suggestions… Something like that i suppose
With this approach you may also need to trim the username first if you have a limit set for example if you have a maximum of 15 characters the username
MyUsernameTests
If you was to add a 3 digit code directly here you would pass the limit and it would be 18 characters which could cause you issues depending on the structure of your app and database
So you could just trim the last 3 characters from the username before generating a random 3 digits in this case
Again this is only if you have a character limit in place
I’ve got the point brother. There are a few checks and procedures I have to follow (I wouldn’t expect less…)
I was just wondering if there was a kind of “specific” approach to this functionality.
Anyway I’m going to give it a try and see what I’ll come up with at the end.