In user accounts we have two Term fields that use the same taxonomy vocabulary. For example, the user profile has I need and a I have fields.

For example User A has a blue crayon but wants a red one.

- I have 
-- X Blue Crayon
-- - Red Crayon
-- - Green Crayon
- I want 
-- - Blue Crayon
-- X Red Crayon
-- - Green Crayon

I would like to craft a view that, based on User A's desire marked want, finds all users that have Red Crayon they want to lend.

Ideally, I'd like to auto populate this contextual filter with what the logged in user has specified. For example in this situation, I want to populate When the filter value is not in the URL's Provide Default Value field with the term_id of Red Crayon. Thus, listing everyone with ready to lend a red crayon.

enter image description here


From the create view wizard, you need to choose, show "Users."

In the filters section you'll create a filter for "I want" whose value is set via PHP to grab the current users choice for "I have." You'll need the Views PHP module for this.

  • What about contextual filter? Is there a way to populate this based on the logged in user's profile?
    – Rick
    Nov 11 '14 at 21:15
  • You are trying to populate the value of a filter with a value from another field. That doesn't seem doable to me via a contextual filter.
    – Shai
    Nov 11 '14 at 21:35
  • Upon further research, here is a recipe that uses the Views Field View module to achieve what you are after... using contextual arguments.
    – Shai
    Nov 12 '14 at 3:46

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.