0

I have a use case where I need to create a page for members of two specific roles (Contributor and NAD Contributor) to see their own unpublished content. Using views relationships and filters, I've created a tabbed page display at the path user/%/unpublished that only displays unpublished content belonging to the logged in user. All that works great except for one thing; the tab itself is visible on all user accounts, even though it's only visible to users of the specific roles. What this means is that there is a Unpublished tab (with no content) for other roles that don't need this page, so for instance the two Contributor roles would see an Unpublished tab on users of other roles.

Is there a way within Views to control the display of this tab to only be displayed on the profile pages of the roles specified in the Access settings for the display?

Thanks.

  • The way the access is meant, those are the roles users need to have to see the tab. Definitively, it's not what you want. – kiamlaluno Jun 10 '16 at 19:56
0

You might have already thought about this, but you could make a Panel Variant that only shows to those roles.

  • Yeah, good thought, since I'm already using the built in user panel page for the profile. However, we're just using a single column layout and I don't want to add another pane in the mix. I think I might just have to do it as a block and display it in the sidebar. The list will usually be pretty small. – wonder95 Jun 10 '16 at 18:32
0

I assume that your context filter is Content: Author uid. In that case, you can add a validation criteria, following these steps.

  • Under When the filter value IS available or a default is provided, select Specify validation criteria
  • As Validator, select User
  • Select Restrict user based on role
  • Under Restrict to the selected roles, select the roles you need the view visible
  • On Action to take if filter value does not validate, select Hide view

screenshot

This is also applicable when the contextual filter is Content: User posted or commented.

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.