Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

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.

Enter your email address:
 
Feel free to ask any question. Just leave your comment below and we will answer your comment with in 24 hours.
Share: