public function __construct(SessionData $session) { $this->id = $session->get_user_id(); $this->level = $session->get_cached_data('level', -1); $this->is_admin = $this->level == 2; $this->display_name = $session->get_cached_data('display_name', SessionData::DEFAULT_VISITOR_DISPLAY_NAME); $this->email = $session->get_cached_data('email', null); $this->show_email = $session->get_cached_data('show_email', false); $this->unread_pm = $session->get_cached_data('unread_pm', 0); $this->timestamp = $session->get_cached_data('timestamp', time()); $this->warning_percentage = $session->get_cached_data('warning_percentage', 0); $this->delay_banned = $session->get_cached_data('delay_banned', 0); $this->delay_readonly = $session->get_cached_data('delay_readonly', 0); $user_accounts_config = UserAccountsConfig::load(); $this->locale = $session->get_cached_data('locale', $user_accounts_config->get_default_lang()); $this->theme = $session->get_cached_data('theme', $user_accounts_config->get_default_theme()); $this->timezone = $session->get_cached_data('timezone', GeneralConfig::load()->get_site_timezone()); $this->editor = $session->get_cached_data('editor', ContentFormattingConfig::load()->get_default_editor()); $this->build_groups($session); }