Page 1 of 1

Allow reuse of username

Posted: Tue Nov 25, 2014 8:49 am
by Tomtefar2
Hi,

I wonder if someone knows a way to modify my phpbb 3.1.1 board to allow the reuse of usernames (like the reuse feature in ACP for e-mail, which will not be used for obvious reasons)?

I will use the username field for "First name Last name" eg. "John Doe". For this reason I want to allow the same username to be used again. I am also trying to modify my board so users login with e-mail instead of username: viewtopic.php?f=466&t=2278006

Thank you!

Re: Allow reuse of username

Posted: Tue Nov 25, 2014 9:00 am
by janus_zonstraal
And what are you going to do with the post of the "old" username?

Re: Allow reuse of username

Posted: Tue Nov 25, 2014 9:10 am
by Tomtefar2
The board is not live yet so there are no users, for this reason there is no old username. Or do I understand you wrong? Do you mean when there is an existing user and a new one tries to register with the same name (and therefore username)? If that is the case this is the problem I need to solve. The unique key for the user should be email (and index in database) instead of username as it is currently.

Re: Allow reuse of username

Posted: Tue Nov 25, 2014 9:50 am
by Wolfsblvt
An easy workaround for this, maybe:
Use the username field as email field. So users are in fact email adresses. Add profile fileds for first and last name. Modify template to show the profile fields instead of the username on each place where you want.

Username should be unique, otherwise it may lead to several uncontrollable errors.

Re: Allow reuse of username

Posted: Tue Nov 25, 2014 12:31 pm
by Tomtefar2
I have thought of this solution and it is not a bad suggestion. I see three problems:
1. Email validation will not work as intended
2. Email field needs to be populated on registration
3. Username is used literally everywhere. Member search needs to be changed etc.

My guess is that it would be easier to enable the reuse of usernames (the same function that is used for email in ACP exists) and change login to email validation instead of username validation. In my mind this seems to need less change and be more "correct".

Re: Allow reuse of username

Posted: Tue Nov 25, 2014 12:42 pm
by Wolfsblvt
I don't know how often the core uses just usernames to get user data, but surely extensions will. You can't get users by their username anymore. Don't know to wich problems this may lead.
You can try, of course, but I would be cautious with it.

Just a random idea. What about adding something to the username if it already exists, like some rarely used special character followed by a digit, wich makes the name unique, and strip of this when you get the username.
But this wouldn't solve the places where it is used and the member search, etc.

Sounds not like an easy extension.

Re: Allow reuse of username

Posted: Tue Nov 25, 2014 4:40 pm
by Tomtefar2
Wolfsblvt wrote:I don't know how often the core uses just usernames to get user data, but surely extensions will. You can't get users by their username anymore. Don't know to wich problems this may lead.
You can try, of course, but I would be cautious with it.

Just a random idea. What about adding something to the username if it already exists, like some rarely used special character followed by a digit, wich makes the name unique, and strip of this when you get the username.
But this wouldn't solve the places where it is used and the member search, etc.

Sounds not like an easy extension.
Thank you for the heads up, did not think about that part.

I have thought of the possibility as well to add characters but I did not find a solution that satisfied me.

My thought is that if one can enable and disable the reuse of e-mail, this function should not be that hard to "copy" and apply for username, however, I do not possess the necessary knowledge.