-
I am currently tweaking a Kanboard theme plugin. I want the theme to be applied only when the user is not an admin or not logged in. I have tried this, but did not work. public function initialize()
{
if ($this->userSession->isAdmin()) return;
$this->template->setTemplateOverride(...);
... stripped ...
} Probably because the session is not active when the plugins were loaded. If so, what is the correct way to satisfy my intention (initialize theme only when user is not admin)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
maybe this will help you: it sets the theme to the users theme. I put it in i think i have noticed it does not work perfectly, its been a long time since i have played around with it, but if my memory serves me, once in a blue moon it takes a second navigation to pick up the session. |
Beta Was this translation helpful? Give feedback.
maybe this will help you:
https://github.com/creecros/Customizer/blob/8200b2fb4091ac445333a83d5d8bf9914065d758/Plugin.php#L131-L139
it sets the theme to the users theme. I put it in
onStartup()
.using
$this->userSession->getId();
which will not work in the Plugin.php, which is why i threw it in a model and then call it.i think i have noticed it does not work perfectly, its been a long time since i have played around with it, but if my memory serves me, once in a blue moon it takes a second navigation to pick up the session.