Noel Boss Posted March 12, 2019 Share Posted March 12, 2019 Hi Folks I want to access $user->language inside the init hook because I want to make some access checks; $this->wire()->addHookAfter('Page::viewable', $this, 'checkAccessHook'); – but I get only the default language: $user->language->name > default However, I do have the correct user ID and I would have expected that at least using pages->get I can fetch the correct language via a custom lookup?! $pages->get('id=$user->id, include=all')->language; But nope... still just default. Any ideas? ––– Alternatively, @ryan if you are listening – I think there is a hook missing to inject access restrictions etc. – somewhere deep down (and early) in the system – that also works for find() operations etc. Most everything is there with PW but this has been a major pain-point for our current project with complicated user access restrictions and configurations. If we could hook into somewhere, that would be amazing. Currently it's really tricky and quickly gets messy when we have user dependecies and with the order if init() and ready() and page::viewable() Link to comment Share on other sites More sharing options...
Zeka Posted March 12, 2019 Share Posted March 12, 2019 @Noel Boss Not sure that it's going to help, but you can play with the priority of your hooks. Language support is also added via hooks in LanguageSupport.module. So make sure your hook is going after. 1 Link to comment Share on other sites More sharing options...
Noel Boss Posted March 26, 2019 Author Share Posted March 26, 2019 Thanks @Zeka, I know the priority thing, but in case of init and ready, this is not of much use… Link to comment Share on other sites More sharing options...
bernhard Posted November 1, 2019 Share Posted November 1, 2019 @Noel Boss did you find a solution? This thread is related: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now