0

I'm using the views module's built-in "Taxonomy term" view which overrides the way Drupal displays taxonomy by default and makes it accessible to views. However, this only works for content, not users.

I tried creating a new view that lists users but there is no contextual filter like "User: has taxonomy term", just "Content: has taxonomy term." In my case, however, some of the fields I want to display are term references stored on the user profile; they don't exist on any content.

Ideally, this is what I want: if a user visits the page taxonomy/term/oranges, it will show all users who have "oranges" in a taxonomy reference field. How can I do this?

  • I guess you'll have to use a Relationship in your View. If your user has the field, it will appear in the list. – Countzero Mar 22 '12 at 8:34
  • I have already configured a relationship (Content: Author). However, though this makes the taxonomy term available under Fields, I am trying to show the users that have been "tagged" with the taxonomy term based on the term ID (The "Taxonomy Term" view shows all content that has been tagged with a term; I want to do the same for users.) Adding a relationship alone does not allow me to do this. – Patrick Kenny Mar 22 '12 at 12:11
  • 1
    There doesn't seem to be a direct way to do what you want, at my great surprise. This thread, though, contains some snippets which should do the job. – Countzero Mar 22 '12 at 12:28
  • 1
    This works a little better: drupal.stackexchange.com/questions/9332/…. – Sun Rhythms Sep 27 '12 at 14:43
2

I ended up implementing this by overriding the taxonomy page with panels instead of views. I then made the old view taxonomy term override into a content pane. Then, to get the "User: has taxonomy term" effect, I made a view (content pane) for each vocabulary with a "Term ID" contextual filter (supplied as a panel argument) and a relationship of "Taxonomy term: User using MY TERM". I then added these views as content panes to the taxonomy override in panels.

I had to do this for each vocabulary, but it works.

0

I found a different solution by using EVA.

In my case, I have a dentistry website that has a taxonomy vocabulary named as "Expertise" and terms named as "Endodontics‎, Pedodontology‎" etc.

Dentist members can choose their area of expertises from this vocabulary on their profile2 pages ("Field: Expertise" as a term referenced field, profile2 is not neccessary at all).

I was trying to show term related dentists on taxonomy term archive pages. So I did this:

  1. I created a Profiles block View that displays fields (You can create Users block if you don't use Profile2)
  2. Added a Relationship -> Profile:Expertise
  3. Added a Contexual filter -> (term from field_expertise) Taxonomy term: Term ID
  4. Added an EVA Field
  5. Selected Entity Type: Taxonomy Term
  6. Selected Budles: Expertise
  7. Selected Arguments: id
  8. Set up EVA field "Visible" from "Expertise" vocabulary display (admin/structure/taxonomy/EXPERTISE/display

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.