private function check_username($id, $args) { $str = $_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 (!$Users->username_available($str, $exclude_userID)) { return false; } return true; }