I have users with a "field_org" entity reference (multiple values allowed) to the "Org" content type. I also have a "field_org" (single value) in my "Article" content type.

When looking at a user profile (let's call this user "UserA"), how do I build a view that gets you "articles from your orgs" (i.e. created by other users that also belong to any of UserA's orgs)? And, bonus question: how do I exclude articles created by UserA? (since I have a separate "your articles" view showing in the same page).

I know this is probably a combination of relationships and contextual filters, but I can't figure out exactly how to configure them. Probably something like this:

  • Contextual filter on node author to prevent "UserA's articles" from showing (set to "exclude" in the options)
  • Contextual filter on node author, but probably set to one of the relationships below.
  • Relationship between article nodes and orgs?
  • Relationship between orgs and users?

Both contextual filters would load the same user ID using "Provide default value".

1 Answer 1

  1. Create a content view
  2. Add the Content: Author relationship
  3. Add the Content: Author uid contenxtual filter
    • Provide default value: User ID from URL

So far we have a view displaying content created by a certain user, we still have to narrow down the results to a single content type.

  1. Add the Content: Type filter = Org

Note that a page view (with a path) will show no results if you just hit the path. To have results you must pass a uid to the url, like mypath/%uid. On the other hand you can create a block or a content pane and place/embedded it to the user's profile, view's will return all results (if any) for you!


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.