I have a "Company" node type and a "Content" node type.

In my User profiles I have added a nodereference to the appropriate Company node, and in the Content nodes, I have also added a nodereference to the Company owning the content.

What I am trying to do is to construct a view that will present the logged-in user a list of all Content nodes owned by (i.e. with references to) the user's company.

Pseudo-sql would be something like this:

SELECT n.title FROM node n,user u WHERE 
n.company_reference = u.company_reference AND logged_in_user.uid = u.uid

There ought to be a way to do this via Views, I just have been unable to figure out how, so any suggestions or pointers will be greatly appreciated


did something similar using panels and view panes. Without panels I'm not sure how I would approach it. You can create a view that lists all the content nodes. then create a display of that view that is a "content pane" (requires panels). Go into advanced, and create a "contextual filter" based on the criteria you want (in your case it would be your node reference to the company). Then click "argument input" under pane settings. you should now be able to add this pane to a panel and pass it the correct argument. I know it's a little confusing written out .... but with this setup you could for instance make a panel that shows the user, the users company, and a list of the content nodes owned by that company.

I've posted this a couple times here, only because it really helped me understand contextual filters and how you can build some pretty awesome things just using them with views and panels


  • Thanks - I did try this, pretty explicitly following the steps in the video you linked. It all worked great EXCEPT it never actually would show me any data ;-/. The View pane worked fine, but only when I tested it in Views UI. I imagine I could get it to work eventually, but just didn't have time to mess with it. It was faster and more straightforward (if less flexible) to write a new module instead. – jmarkel Dec 31 '11 at 22:59

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.