I’ve got two roles in a multilanguage site (en/fr):
admin
traveler
For the traveler role, I would like to disable (or better hide) the language selector in the panel and redirect the traveler user automatically to its own language based on its panel language which is French or English.
I don’t want for French or English users with traveler role to have to choose the language of their content.
The panel language selector should be set to English by default for English traveler user and set to French by default for French traveler user with no possibility to switch between the two languages in the panel.
Hide the language selector with CSS was easy but I don’t find how to target language in the query string. So I made a custom method for the site object in a plugin that redirects the user to the right language panel view and call this method with the home option.
For those interrested, this is my index.php plugin code:
Thanks, both of you!
The snippet from @gillesvauvarin actually doesn’t work. I liked the idea.
Being new to Kirby this is quite complex for me. How can I get the user-panel-language in route:before and what can I do with the result? Just alert an error message like: “You are not allowed to work on these pages.”? AND how this should be coded?