0

I have a content type requests with the taxonomy field categories. I have added categories to my user's profile as well.

I need to create a view that displays all the requests that have category terms the user has selected in their profile. How do I go about this?

0
  1. Create a view showing requests.

  2. Add a contextual filter for Field: Category.

  3. When the filter value is NOT in the URL choose "Provide default value" of type PHP.

  4. In the "PHP contextual filter code" write:


global $user;
$account = user_load($user->uid);
return $account->field_category['und'][0]['tid']; // this line may need changing based on your category field name

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.