$username_safe, 'user_pass' => $password, 'user_email' => $email_safe, 'role' => 'subscriber' ); $user_id = wp_insert_user($userdata); return $user_id; } public static function is_username_taken($username) { if (username_exists($username)) return true; return false; } public static function is_email_taken($email) { if (email_exists($email)) return true; return false; } public static function is_valid_password($password) { if (strlen($password) < self::MIN_PASS_LENGTH) return false; return true; } public static function is_valid_email($email) { if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { return false; } return true; } public static function is_valid_username($username) { if (strlen($username) > self::MAX_USERNAME_LENGTH) return false; return true; } } class LoginTakenException extends Exception { } class InvalidPasswordException extends Exception { } class InvalidEmailException extends Exception { } class InvalidUsernameException extends Exception { }