3

I have been trying to do this last couple of days but no luck.

Every user have a custom field (favorite_car) which is taxonomy and there is different terms ('Audi','Bmw' etc).

I have also content type 'Cars' which had also a custom field (favorite_car).

I need to display only the results, that user have selected. If user have a custom field selected to 'Bmw', view need to return only nodes which have a favorite_car field set to 'Bmw'.

I think that there is a way to do this in drupal 7. Every kind of help is welcome.

4

You can filter contents on their term_reference_field by the field_value of a term_reference_field of the current_user:

So we go:

  • Create a content_view

  • Create a relationship with "favorite_car"

  • Create a relationship with "term from favorite_car"

  • Create contextual filter user:uid with provide default_value: user_id from logged in user and the relationship favorite_car

This works for me!

0

Look at the answer to Add Taxonomy Term automatically based on term from user's account

Replace the references to "state of residence" with "favorite car" and references to "forum postings view" with "car listings view".

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.