You might already suspected it, I'm talking about groups. I've a content type what represents groups, the node/group is referred in a field (field_group) on the user entity. With this relation I want to define "permissions" in views.

For example the blog I build now displays content of all groups, no matter what group you are in, the view will always display all blog nodes. Now I want only to display the nodes what have an author with a field_group value equal to the currently logged in user its field_group value.

How should I do this in views? Some people mentioned to use contextual filters, I tried some common options but it didn't resulted like expected...

Please, let me know if you know a working setup.

Thanks ~ F.


1 Answer 1


Found out how it should be done if you can refer to an author.

My setup:

  1. add relation ship Content : Author as "author"
  2. add relation ship User: Group (field_group) - Appears in: user:user. with the relation to "author".
  3. add contextual filter User: Group (field_group) - Appears in: user:user. with at "When the filter value is NOT available" -> "Provide default value" -> "PHP Code" the following code: global $user; $data = user_load($user->uid, TRUE); return $data->field_group['und'][0]['nid'];

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.