2
votes

I am attempting to set up 2 new views integrated with the flag module. I have set up a flag to follow / unfollow a user. I want to set up two views to show a list of users a user follow, and one that shows who follows the user we are viewing. I have created a view to show the users the user is following and added the following relationships and contextual filters:

Relationships:

Flags: User flag - any user Flags: User

Contextual filters User: Uid - Provide a default value user id from URL.

My views path is user/%/following but it is not displaying any results. Any ideas? and how could i go about setting up the second view?

Thanks

1

1 Answers

2
votes

This is a tricky one!!

You want the filter you're creating for your view not to be the user that will be listed, but to be the user who followed the one that should be listed.

To accomplish this, you need one more relationship! After adding your flag relationship (and I would even just go ahead and check the specific user flag when I create it, such as the 'follow flag'), you'll see some additional options appear in your relationship areas that were not present before.

Go ahead and add another relationship, and this time, select 'Flags: User', which you can see is 'The user that flagged an item'. I would require this relationship, and of course, select that it applies to the specific flag that you included in your first relationship. Here are my precise settings:

enter image description here

Now, when you set up your Contextual filter, which should indeed get its id from the URL when one isn't present, just make sure to ask it to relate not to the user that should be listed, but to the user that did the following:

enter image description here

That should do it for you! Let us know if it works!