{
StyleHandler::getInstance()->changeStyle($this->style->styleID);
if (StyleHandler::getInstance()->getStyle()->styleID == $this->style->styleID) {
- WCF::getSession()->setStyleID($this->style->styleID);
-
if (WCF::getUser()->userID) {
// set this as the permanent style
$userAction = new UserAction([WCF::getUser()], 'update', [
],
]);
$userAction->executeAction();
+ } else {
+ if ($this->style->isDefault) {
+ WCF::getSession()->unregister('styleID');
+ } else {
+ WCF::getSession()->register('styleID', $this->style->styleID);
+ }
}
}
}
*/
protected function initStyle()
{
+ if (self::getSession()->getUser()->userID) {
+ $styleID = self::getSession()->getUser()->styleID ?: 0;
+ } else {
+ $styleID = self::getSession()->getVar('styleID') ?: 0;
+ }
+
$styleHandler = StyleHandler::getInstance();
- $styleHandler->changeStyle(self::getSession()->getStyleID());
+ $styleHandler->changeStyle($styleID);
}
/**
*/
protected $legacySession;
- /**
- * style id
- * @var int
- */
- protected $styleID;
-
/**
* user object
* @var User
{
$this->defineConstants();
- // assign language and style id
+ // assign language
$this->languageID = $this->getVar('languageID') ?: $this->user->languageID;
- $this->styleID = $this->getVar('styleID') ?: $this->user->styleID;
// https://github.com/WoltLab/WCF/issues/2568
if ($this->getVar('__wcfIsFirstVisit') === true) {
$this->groupData = null;
$this->languageIDs = null;
$this->languageID = $this->user->languageID;
- $this->styleID = $this->user->styleID;
// change language
WCF::setLanguage($this->languageID ?: 0);
$this->register('languageID', $this->languageID);
}
- /**
- * @deprecated 5.5 - Use `StyleHandler::getInstance()->getStyle()->styleID` instead.
- */
- public function getStyleID()
- {
- return $this->styleID;
- }
-
- /**
- * @deprecated 5.5 - Set the style directly with the `StyleAction::changeStyle()`.
- */
- public function setStyleID($styleID)
- {
- $this->styleID = $styleID;
- $this->register('styleID', $this->styleID);
- }
-
/**
* Resets session-specific storage data.
*