2

I have several views pages set up on my site that filter the content that is shown to normal visitors. In general, these views will show users content that they have created. However, when an admin user visits one of these pages, I want them to see all of the content (created by everyone.) Currently, I have a rule set up which will redirect all admin users to a different url which has a different view (with access restricted to admin users and no filters) Functionally, this does want I want (all users click on the same menu link, but eventually reach different pages.)

I am wondering, does the rules redirect event happen before the first view is loaded? I want for the redirect to happen as soon as possible to save server resources and load time. So, If the redirect happens after the page is created, it would be better for me to change my navigation strategy.

1 Answer 1

0

You have not specified the exact condition you are using. If you are using 'When content is viewed by an authenticated user' condition, then yes, views are being loaded in node load hooks, and they are already there by that time. The good news is that if these are cached, it will lighten things up, and the amount of admins is always limited, so a non-issue performance-wise.

But, if you really wanted to make one view show to one user and another to another, this is what you can do:

  1. Create a separate block for each view display.
  2. Put these blocks on the page.
  3. Apply conditions for blocks that will show them for specific roles. Advanced to admins, and usual for non-admins, or all else.

And voila - you will have a solution without redirects and overhead.

2
  • Action: Drupal is initializing. Conditions: Check path and User has role(s). Action: Page redirect
    – Hoytman
    Commented Apr 18, 2014 at 12:52
  • Then it's ok, no views are loaded at that time. Commented Apr 18, 2014 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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