So, I've been able to:
* Get a list of all (nodes of type A) that the (contextual User ID) has flagged.
This is great for something like user/%/my-flags. Fine. Awesome.
But, what if I wanted to get a little crazier? Say I have "Flag Follower" enabled. I've followed 5 users. Now, I don't want to see their CONTENT (as the default included View does), but I want to see what THEY'VE FLAGGED. And, for bonus points, I'd like to see what WE'VE flagged. To some degree, I'm looking for a single activity stream of all the flags of myself and whom I'm following. Is that possible? Something like https://www.truetrophies.com/gamer/MorbusIff where all of the "user has won this trophy" are the equivalent of "my followed user, or myself, has flagged this content".
Comments
Comment #2
joachim CreditAttribution: joachim as a volunteer commentedSeems doable with an extra relationship.
Comment #3
Raphael Apard CreditAttribution: Raphael Apard commentedIs there a getUserFlaggings() method ? I didn't find it. Only the getUserFlagFlaggingCount() from FlagCountService ?
I had to use a custom query
Comment #4
droprocker CreditAttribution: droprocker commentedI'm searching for the same thing. Does anyone have a hint how to achieve this!?
Joachim, you say it's doable with an extra relationship. Which one?
Comment #5
joachim CreditAttribution: joachim as a volunteer commentedWell you want:
Content -> node related to author user -> user related to flagging -> flagging owned by current user
Comment #6
droprocker CreditAttribution: droprocker commentedWell, I'm sorry but I don't get it... I always just get as a result the content the user I follow created/authored, not the content this user has flagged.
Comment #7
joachim CreditAttribution: joachim as a volunteer commentedCan you try debugging the Views query?
Comment #8
droprocker CreditAttribution: droprocker commentedThe SQL Query is the following:
Comment #9
joachim CreditAttribution: joachim as a volunteer commented> LEFT JOIN {users_field_data} users_field_data_node_field_data ON node_field_data.uid = users_field_data_node_field_data.uid
INNER JOIN {flagging} flagging_users_field_data ON users_field_data_node_field_data.uid = flagging_users_field_data.entity_id AND (flagging_users_field_data.flag_id = 'following' AND flagging_users_field_data.uid = '1')
Here you're saying the the node author needs to be flagged by the current user.
Comment #10
Web-BeestIf you want to use the session_id (in case of anonymous users), you should use the session id generated by the flag service in stead of the sessionManager. They are different ;-)