private function check_email($id, $args) { $email = $_POST[$id]; $Users = new PerchUsers(); // check for a passed in UserID // so that a user can be excluded from the check // (so we don't prevent editing of a record) if (isset($args['userID'])) { $exclude_userID = $args['userID']; } else { $exclude_userID = false; } if (!PerchUtil::is_valid_email($email) || PerchUtil::contains_bad_str($email) || !$Users->email_available($email, $exclude_userID)) { return false; } return true; }