18

I have a user flag that is pretty much like a "follow" or "subscribe" function.

Basically I want to create 3 views for my website's user profile pages:

  1. A list of users flagged by a user (e.g. a "people i'm following" block)
  2. A list of users flagging a user (e.g. a "my fans" or "my followers" block)
  3. A list of nodes from all the users that have been flagged by a user (i.e. a news feed function for a user to view all the new content from the users he/she flagged)

Would appreciate any help or comments!

  • drupal.org/node/296971 did not help? Although it is for D6, but the general approach should be still pretty similar... – Maciej Zgadzaj Jul 2 '11 at 21:13
  • Did you ever come up with solutions for 2 and 3? I've been racking my brain trying to figure out this exact scenario. – Mrweiner Jan 10 '13 at 1:39
  • this is something I am interested in accomplishing as well. – user379468 Feb 19 '13 at 19:40
  • Trying to set this up on D8. Any ideas? – Progonat Sep 4 '18 at 18:34
4

Better late than never, To get your followers of fans you can:

  1. create a view of type users.
  2. create a relationship Flags: User's flaggings.
  3. now this is were most people go wrong you should remove "Include only users who have flagged content."
  4. chose your flag.
  5. Add Contextual filter "Flags: Content ID".
  6. make sure to use the relationship.
  7. WHEN THE FILTER VALUE IS NOT AVAILABLE provide default value of "user Id from logged in user".
1

The first scenerio can be attained by doing the following (in drupal 7)

  1. Add the 'Flags: [flag type]' relationship, and set 'By' to 'Any user.'
  2. Add the 'Flags: User' relationship; don't set any options for it.
  3. Add the 'User: Uid' contextual filter, and set it to 'Provide default value' 'User ID from URL'.

if you are using panels, you have to make sure you pass the uid to the view.

still working on figuring out the other two scenarios, let me know if you hace any luck

1

I was struggling to get number 2, but thanks to this answer: How can I make a view that shows users all the who have flagged a single user?

  1. Create a view of users
  2. Add the relationship "User's flaggings" and uncheck the "Include only users who have flagged content" checkbox.
  3. Add a contextual filter "Flags: entity ID", and choose the method to provide a default value - in my case, get User ID from URL.
  • How to create a view with content from "Current user" + "Content from flagged users". Users will be flagged by follow flag. For example: If I had to create a view with "Content from flagged users only" then I would simply add a relationship with "follow flag"(user) and check "include content from flagged users", but it will not show content from current user. – Umair Jan 7 '17 at 7:29
0

I believe I figured out how to configure number 1 and 3.

  1. Create a view of Users (rather than content).
  2. Add the flag as a relationship (the flog following or whatever you call it) and add By "current user". This should get you a list of the users you are following.
  3. Add "User: Content Authored" as another relationship this should give you a duplicate row for every piece of content that the user has authored.

Now you should be able to use fields to omit or ad whatever info you want.

0

Yes, that's the right answer, user379468!

Instead of the third point use:

  1. Add the "User: Content Authored"
  2. Add the "User:uid" contextual filter
  3. Add the "(Author) flags: (name_of_your_user_flag)" relationship
0

A list of users flagging a user (i.e. a "my fans" or "my followers" block)

  1. create a new view, based on users.
  2. add relationship Flags: User's flagged content
    • ACTIVE : Include only users who have flagged content.
    • Choose your flag name

thats it.

Perhaps you want to add a filter to filter out your own name ..

  • not working, my apologies. – blogook Jan 19 '12 at 23:04

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.