views:

58

answers:

2

I have a Drupal setup like this:

  • Content type: Apartments
  • Vocabulary: Areas, that can be used with Apartments.
  • Content type: User profile, with a Content Taxonomy Field for Areas so users can select what areas they are interested in.

I would like a view that shows all the user profiles that matches the apartments in their area. A "User profile <-> Areas <-> Apartments" join in other words. I've been mucking around with the views interface for a while but it's not clear to me how the relations can be setup to achieve this. Can someone give me a hint?

In case this cannot be easily solved with views, what is a good way of doing it otherwise? Thanks for your help.

A: 

In my experience I've found that views doesn't do taxonomy very well. It's often quite hard to get what you want and then you sometime strugle with duplicates. Often I've found myself hitting a dead end using views for this.

In this case I would probably do this in a custom module. You don't have to do much. You should be able to make a simple query where you get all apartment nodes that has the same tid as the user profile. Then it's just a matter of what info you want to pull out. You should avoid making node_load() as it'll slow the page down a lot.

googletorp
Thank you very much, I reached the same conclusion about views. I'm still a Drupal newbie regarding modules, so do you have a link to some tutorial that is similar to what you propose? I'm very interested in knowing how to make something like that.
ciscoheat
A: 

Check out this post: http://thereisamoduleforthat.com/content/using-default-arguments-relate-nodes-their-common-taxonomy-terms. It explains how to do what you want.

infojunkie

related questions