I have a term reference field in my user accounts and I have nodes that are also tagged with that same vocabulary.

I have a view set up to display all the nodes, but I want it to display only nodes that have the terms that the users has checked in their account.


Node: Shirt
Term(s): Blue

Node: Skirt
Term(s): Green, Blue

Node: Dress
Term(s): Red

Node: Shoes
Term(s): Purple

My user has terms: Blue, Red

I would like to see nodes: Shirt, Skirt, Dress

  • If I understand your question correctly, you want to setup a relationship to the taxonomy term and then to the user. You "may" also to to add a contextual filter for the current user, but I'm not sure, however, the relationship should help. – Jav Sep 25 '13 at 3:44

One of the possible solution can be

  • Create a view to show the nodes with contextual filters as taxonomy,remember to allow multiple taxonomy terms may be separated by '+' in the contextual filters.

  • Create a custom menu item in your custom module and in the page callback of which grab the taxonomy terms in the global user object and call the above created view programmatically.

  • Here is a snippet showing how you can call your view programmatically with contextual filters.

    views_embed_view("your_view_name", "your_view_dsiplay", $taxonomy_terms_+_separated)

See the following screenshots.

In my test installation, I created the following taxonomy terms: test1,test2,test3,and test4. I created 4 nodes too, each of them using one of those taxonomy terms (node1 => test1, node2 => test2, etc.).

The following is the screenshot of a view page showing the nodes using the taxonomy IDs passed as contextual filters.


These are the screenshots of the view configuration for those for contextual filters.




  • Thank you for the tips! This is getting me somewhere... it even might work as a fixed value with php in the contextual filter. The one thing I'm having trouble with now is the use of multiple filters. When I pass multiple (either with comma or plus), it only uses the first and brings up the corresponding node. Any idea why it won't listen to using multiple? I've also tried with and without the validation with the taxonomy using the term IDs. No change. – Deez Sep 25 '13 at 17:25
  • You have to set in the views to allow to have multiple taxonomies,I do not have my PC with me right now otherwise I would have added a screenshot – arpitr Sep 25 '13 at 18:16
  • I think I do have it set that way... For "When the filter value is NOT available" I have "hide view", "When the filter value IS available or a default is provided" = "Specify validation criteria / Taxonomy Term", and then I have the vocab selected and "Filter value type" is "Term IDs separated by , or +" – Deez Sep 25 '13 at 18:24
  • Did you check passing the multiple taxonomy terms in the preview down below in the views to debug – arpitr Sep 25 '13 at 18:25
  • Yes, I tried it in the preview and it only listens to the first ID. So if I swap the order, it will listen to the order, but never both. – Deez Sep 25 '13 at 18:27

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.