EE requires screen_names to be unique. Previously, in conjunction with Profile:Edit, I have appended {current_time} on to the end of a user's screen_name during registration to workaround this (it's not used anywhere on the front end so is useless to me). However, the screen_name variable is used in the default forgotten password email, and there are no other suitable variables available in that email template. So I'm finally resorting to a hack.

Around line 227 of system/libraries/Validate.php there is this

        /** -------------------------------------
        /**  Is screen name taken?
        /** -------------------------------------*/

        if (strtolower($this->cur_screen_name) != strtolower($this->screen_name))
            $query = $this->EE->db->query("SELECT COUNT(*) AS count FROM exp_members WHERE screen_name = '".$this->EE->db->escape_str($this->screen_name)."'");

            if ($query->row('count')  > 0)
                $this->errors[] = $this->EE->lang->line('screen_name_taken');

Can anyone foresee any problems with simple commenting out this whole block? Is there even a reason I haven't thought of as to why screen_names should be unique?

1 Answer 1


I'm not sure about the system ramifications about having non-unique screen names but I'd definitely try to keep them unique, even from an identity point of view. Usually if screen names are used they are to be displayed on the front-end of the site. Identities could quite easily be confused.

The other potential downfall is that it makes the use of {screen_name} unsafe for member account operations. Even though you're not using it now you may later forget about your hack and then do a check on the {screen_name} value which could result in incorrect or duplicate returns.

I'd definitely look to try to avoid this as much as possible.

Out of interest is there any particular reason why you need them to NOT be unique?

  • I see how it makes sense for sites where there is a community, but in this case it will be a closed system, and users will be addressed by the proper names. I thin you're right though, this hack makes me uncomfortable in case things change. I'm really trying to lower the barriers to registration by just asking for email, password, first name and last name in the first instance... Commented Jun 26, 2013 at 22:56
  • I think it's doable if you needed to but just make sure you document the why's and where's well. :)
    – Ian Young
    Commented Jul 4, 2013 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.