I want to build a view that displays one set of users if the currently logged in $user doesn't have a certain role, and a different set of users if the currently logged in $user does have that role. How can I do this?

Comments

merlinofchaos’s picture

Status: Active » Fixed

Assuming this is a page view, you can provide two displays with the same path. Make the first display(Higher in the tabs list) the more restricted view and use the access settings to restrict it to the role you need. Make the second view less restricted and have them each display what you need.

jim0203’s picture

Status: Fixed » Active

Thanks for the idea, but it doesn't seem to work for my purposes. To provide a little more detail, what I'm doing is building a view and then displaying it in a CCK User Reference field. When normal users create a node that includes this field, I want the list to only show users with a certain role. When an administrator creates a node that includes this field, I want the list to show all users. Is this possible? Apologies for not being entirely clear first time round.

merlinofchaos’s picture

Hm. CCK would need a way to choose multiple displays from the view, not just one. I can't think of a way to do this, currently.

jim0203’s picture

Status: Active » Closed (won't fix)

OK, will take it up in the CCK issue queue. Thanks for your quick responses.

jim0203’s picture

After digging around for a little while I've come across http://drupal.org/project/viewsphpfilter, which I think will do the job in my case - seems pretty flexible, too.