0

I have field in taxonomy term field_user which references to User.

At user own page (for example: user/1) I need to show taxonomy tree like this:
-user1 (this is the user whose page we are)
--user2
--user3
---user4
----user5
----user6
--etc

And if we are for example user4 page then:
-user4
--user5
--user6
--etc

It is not necessary to show current user at the tree, but it should show all terms under that user.

I'm using Views to trying to achieve this, but could not figure out proper settings for it. How to do this?

2
  • Have you tried Views Tree module ?
    – DRUPWAY
    Commented Oct 15, 2014 at 8:33
  • I have it installed, but could not figure out right Relationship and Contextual filters/settings.
    – hene
    Commented Oct 15, 2014 at 8:37

1 Answer 1

0

First, create a new term view using the fields row style / unformatted list of fields (it is important that the tree style not be chosen now). Then:

Add relationship for taxonomy term: parent term
Add field term id (do not use relationship) and exclude it from display
Add field term id with relationship, exclude from display
Add any fields you want to display, like term name, term description, etc...
Change style / format plugin to Tree (Adjacency model)
Set Main field to Term ID
Set Parent field to Term ID with parent relationship

For details refer https://www.drupal.org/node/1493366

https://www.drupal.org/project/views_tree (Compatibility and Usage)

2
  • Ok, that shows whole Taxonomy tree! But now how can I filter it to show only tree under current user?
    – hene
    Commented Oct 15, 2014 at 8:55
  • If I set Contextual filter to Term: User (field_user), set it to use Relationship Parent term and Provide default value: User ID from URL - then it shows only first level child terms, not terms under them.
    – hene
    Commented Oct 15, 2014 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.