[eluser]Unknown[/eluser]
Hi
In a simple user registration form, it is easy in the create form to prevent a user from entering an email address that is already registered by simply using a call_back function. In the edit form, there is no built in way to do this as callback functions only accept on parameter. :-(
Is there a way to either extend the callback function (ugh!) or insert my own error using my own duplicate checking code directly into the controller?
For example the below works but I cannot trigger an error in form validation:
function edit_email_check($str,$id)
{
// PREVENT EMAIL DUPLICATES
$query = $this->db->query("SELECT * FROM users where email = '$str' AND id != '$id'");
$cnt = $query->num_rows();
if ($cnt)
{
//$this->form_validation->set_message('edit_email_check', 'The %s ' . $str . ' is already in use');
return "$str is already in use";
}
return FALSE;
}
Hope I am making sense ...