1

I have a content type with a multiple-values user entity reference field.

I need a view that shows (as two pages or within one view) (a) all the nodes where the user IS referenced and (b) all the nodes where the user is NOT referenced.

There is a relationship to the user reference field and a contextual filter (uid of the logged in user). This "positive" works and shows the nodes where the logged in user is referenced

But the view where the user is not referenced does not work. Is there a way to "negate" the contextual filter (uid of the logged in user)?

I have tried it in one view with an exposed filter (current user), but I could not solve the problem of having multiple user references. I tried the VIEWS distinct feature and the views_distinct modules.

2

You can use exactly the same you did for positive reference but with a single exception. You will see a checkbox contextual field setting names "Exclude". You can check that and the views will exclude the records which have not referenced.

enter image description here

  • Thx Shabir! That did the trick – user24957 Jan 14 '16 at 8:42
  • There is a nut I just can't figure out. Any idea how I can get rid of the data rows where there are multiple user referenced? For example, if there are 3 user referenced, there are two data rows (the logged in user is excluded and thus not showing up). But the other two data rows (with the other 2 user) are showing up. Any idea how I can get rid of those two rows in the view? – user24957 Jan 15 '16 at 9:56

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.