I'm using expressionengine as a CMS but want to override the core validation for new users. When someone registers as a new user, the system checks to see if the screen_name is already taken. If it is, then it throws an error flag.
I've found the section of code that's doing the validation but I'd like to change it so that instead of throwing and error the screen_name is appended with a space and number (one above the count value.
So "John Smith" gets changed to "John Smith 3" (assuming there are two other "John Smith" screen_names in the db).
How can I modify this code to acheive this?
/** -------------------------------------
/** 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');
}
}