Skip to content

How to access current user role in the Plugin initialize() method? #5175

Closed Answered by creecros
lc-at asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lc-at
Comment options

@creecros
Comment options

Answer selected by lc-at
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants