I have previously created a view to search my different content types and it behaves like I want it to.

Now, I would like to limit the search results based on a user profile field. Each content type has an access level field. The access fields are tiered as follows:

A: every one can see it B: only authenticated users can see it C: only authenticated users with a certain profile property can see it

C users can see everything. B users can see B and A content.

My first attempt at this was using a contextual filter and this sort of works. However, it only returns nodes that match the access tier.

I did this with PHP contextual filter code:

$memberAccessLevel = 'Public';

if (!empty($argument->field_membership['und'][0]['value'])) {
    $memberAccessLevel = $argument->field_membership['und'][0]['value'];

return $memberAccessLevel;

My question is, how can I set up the view so that tier C members can see all content?

1 Answer 1


Okay, I found the answer. If my keys are A,B,C, I can return A+B+C to return all nodes marked with either A, B, or C. Basically, you need to concatenate the keys you want with + and that will achieve the desired effect.

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.