Allow duplicate screen_name in register page in Expression Engine
I have started working with Expression Engine since last one year. Today i came across a problem in register page of frontend where my client wants to allow duplicate screen_name while any user register using register form(User module of Expression Engine). This is because user can login with username so there is no need for unique screen_name. Also when we use the register form of Expression Engine, we have to use screen_name and username(required fields). If you use username as unique entry than you can allow users to choose screen_name as per their choices.
By default in Expression Engine when register form submit , username and screen_name should be unique. If users will enter any of this entry which already exists in database than it shows an error says Screen name is already in use.
Below is the solution how to allow duplicate screen_name.
Find file core.validate.php in system >> core dir.
Find :
/** ————————————-
/** Is screen name taken?
/** ————————————-*/
if (strtolower($this->cur_screen_name) != strtolower($this->screen_name))
{
$query = $DB->query("SELECT COUNT(*) AS count FROM exp_members WHERE screen_name = '".$DB->escape_str($this->screen_name)."'");if ($query->row['count'] > 0)
{
$this->errors[] = $LANG->line('screen_name_taken');
}
}
Replace :
/** ————————————-
/** Is screen name taken?
/** ————————————-
if (strtolower($this->cur_screen_name) != strtolower($this->screen_name))
{
$query = $DB->query("SELECT COUNT(*) AS count FROM exp_members WHERE screen_name = '".$DB->escape_str($this->screen_name)."'");if ($query->row['count'] > 0)
{
$this->errors[] = $LANG->line('screen_name_taken');
}
}*/
What we are doing is just comment the code which validates the unique screen_name. Now users can select duplicate name which is already choosen by any other user in Expression Engine.
To know more about programming,JavaScript issues,jQuery,Expression Engine,MYSQL database,php info,php editor,programming php,Open-source,php help and php script , subscribe to our feed by entering email address below. You will get updates via email about every tutorial posted on this site . It will not take more than a sec.






I am
about 2 years ago
Hi Rakshit
Thanks for this posting! We've experienced a comparable situation. However, we'd like users to login via their e-mail address (because else they have to remember their username, and they'll probably remember their email address), so we make use of the User module of Solspace.
We don't allow users to have the same screen name. This because when they leave a comment on the website, we don't want to confuse visitors of the website with multiple people with the same display name. When they start to react in one thread, it all gets even more confusing.
So we've found a good solution. The register form checks dynamically during entrance. As soon as we detect a dupliate screen name we'll add a counter (like #2) dynamically. So it would be Rakshit Patel(#2) in your case.
Try it if you like!
http://www.chatbots.org/register
Erwin
about 2 years ago
Hi Rakshit
Thanks for this posting! We've experienced a comparable situation. However, we'd like users to login via their e-mail address (because else they have to remember their username, and they'll probably remember their email address), so we make use of the User module of Solspace.
We don't allow users to have the same screen name. This because when they leave a comment on the website, we don't want to confuse visitors of the website with multiple people with the same display name. When they start to react in one thread, it all gets even more confusing.
So we've found a good solution. The register form checks dynamically during entrance. As soon as we detect a dupliate screen name we'll add a counter (like #2) dynamically. So it would be Rakshit Patel(#2) in your case.
Try it if you like!
http://www.chatbots.org/register
Erwin
about 1 year ago
Erwin,
Can you share the code you created to do this. We're looking to do exactly what you're doing for our site.
about 1 year ago
Erwin,
Can you share the code you created to do this. We're looking to do exactly what you're doing for our site.
about 1 year ago
Is there any reason, other than members getting confused about who is making a comment, that the screen name must be unique? I saw some discussions on the EE forums where a moderator answered questions about this with a definite “no, the screen name must be unique.”
I have a site where the only time member names are displayed, it’s in the judging section — regular members never interact with each other, so there’s no confusion there. I’m just worried that if I change this, there will be unintended consequences from duplicate names.
It bothers me having to insist that members have to create TWO unique names, one for logging in, and another for their screen name.