What's the best way to deliver a different homepage per user role?

Currently I have an EventSubscriber that redirects the request, but would like to deliver the page at / rather than doing a 302 to /the-other-homepage

  • 3
    drupal.org/project/page_manager you can add page, set it as homepage and add variants based on conditions(user role). If you want to keep your code, you can hook into \Symfony\Component\HttpKernel\KernelEvents::CONTROLLER event and change the controller...or better, use RouteEnancer. I use it for TFA when user want's to access admin pages to display form for TFA code. – user21641 Jul 26 '17 at 20:54
  • Many thanks Ivan I marked Key's answer as the answer as you're both right and page manager is probably what we should be using. However, as the client wants to manage the pages separately I'll look into the events you listed. – Andy Jul 27 '17 at 18:23

Your best option is to use Panels/Page Manager module. Override the default homepage and this will give you a lot of different control options.

What you'd want to do from there is to setup different variants based on the different homepage you want to deliver. Use selection rules to select which role gets access to which version of the homepage.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.