1

I have been trying to do this for many days but no luck.

On registration, user has a choice to choose his/her interests - checkboxes with term reference widget. For example - I have made vocabulary 'Interests' with terms sports, computers, painting etc. Every node is related to terms also.

I need to display only the nodes, that users are interested in. For example, if user checked computers on registration, views have to display only nodes with term computer.

I guess there has to be some way to filter only current users profile_field_interests. I couldn't find a way in Drupal 7.

Any suggestions?

2
  • You want to use the Views module to create the list – actually a list of users (rather than nodes/content).
  • Then you want to use relationships settings to add in the interests.
  • Finally, Add a contextual filter on "user: uid" with a default value fetched from the currently logged-in user.

If you haven't used Views before you in for a ride. If you have used Views but not relationships or arguments/contextual filters, then you're also in for a ride.

There's a pretty nice guide for learning Views in the links in my signature – I hope that can be of help. Look especially for the episode on relationships.

0

This question was asked months ago but i give an alternative answer as a reference (my version is more straightforward but it should perform worse since the filtering occurs in php and not in the SQL):

1) Install and enable the module views_php 2) In your view add to the displayed fields "Content: Author uid". You can set it not to display 3) Create a php filter field and use the following code: a)in the setup:

global $user;
$static=$user->uid;

b) in the filter code:

if ($static == $data->node_uid )
{return FALSE;} else 
{return TRUE;}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy