Closed (duplicate)
Project:
Flag
Version:
6.x-1.1
Component:
Views integration
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Apr 2009 at 13:28 UTC
Updated:
17 May 2009 at 07:48 UTC
Hi does someone have a solution using views? Thanks.
Comments
Comment #1
doublejosh commentedCreate a node view.
Add Relationship.
Flag: "buddy"
By: "current user"
Done.
Comment #2
doublejosh commentedNow can you tell me how to create a list of the user's I've flagged, that doesn't work based on the "current user" radio box?
Comment #3
dropchew commentedI found the solution here. Thanks to all.
http://drupal.org/node/326580
Comment #4
quicksketchComment #5
dropchew commentedSorry for resetting the status,
Its turns out http://drupal.org/node/326580 is not the solution i wanted.
I need to get all flagged nodes (flag by users) from the users I have flagged. So there will be 2 flags, 1 is for flagging node by the other users. Another is user flag, which is use to flag the users. The aim is to get all nodes flagged by them as a whole. It that possible to achieve in a single view? Thanks
Comment #6
doublejosh commentedCurrently you can only get "flagged by: current user" or "flagged by: any user" :(
That's what I was getting at above.
Comment #7
quicksketchI don't think this is currently possible with our existing Views implementation. What you should be able to do:
- Start with user based view, since your first table is a list of users you have flagged.
- Add a "Flag: User flag" relationship for the user-based flag (By: Current user).
- Add a "Flag: User's flagged content" relationship for the node-based flag (By: Any user).
- Add all your fields.
However, it looks like Flag's Views implementation falls a little short here. It should make the flagged content table (node) available for use as fields, filters, arguments, etc., but it doesn't. So the only things you can add to the view are things like the Flagged time, so you can see the time your flagged users flagged content, but you can't actually see what that content is. :P
This is probably only a 1-3 line change somewhere in our Views integration to ensure that the node table is added when using the flagged content argument, it's just a matter of finding what those three lines are, so this could take a while for me to figure out.
Comment #8
dropchew commentedThanks for the thought :)
What I can only think of is to create 2 views,
-User view no.1 with an array of flagged user ids, implode into multiple user id args.
-Node view no.2, takes in multiple user ids args and filter out nodes flagged by them.
Seems like an unorthodox method, but it satisfies my needs for the time being...
Comment #9
sirkitree commentedquicksketch, maybe just in the views_data_alter()?
untested:
However I guess this assumes you're content is a node, or your flag type is node - hrm.
Comment #10
mooffie commentedNate wrote:
I've already done this in the patch attached to #371432: Exposing the flaggings table: Alternative Views support (Search within for "The flagged node.")
sirkitree wrote:
While this "3 line solution" is possible (another variation, somewhat better, is to add a node relationship to the flag_content table), it has two problems:
Comment #11
mooffie commentedNate wrote:
Note that there's an interesting, subtle issue here:
If the view is of type "user" then we won't be able to use any of the node style/display-plugins for it (E.g., we won't be able to use the node RSS plugin).
And vice versa: if a view is of type "node" then user style-plugins won't be available for it.
(That's how matters were "back in my days". Perhaps things have changed, but I doubt it.)
Comment #12
doublejosh commentedThat's the problem. Even the first view here is not possible, (via an arbitrary user.)
Right now you can ONLY get a list of users flagged by either the "Current User" or "Any User". There is no "Flagged by UID" passed via argument.
Comment #13
mooffie commentedOf course it is possible to filter to items flagged by some arbitrary user. That's how the ?q=user/123/bookmarks tab is implemented.
This is mentioned in "A short guide to using the Views integration", and in "How to setup a 'bookmarks' tab on each user's profile page". See the handbook.
===
Other queries will be possible once the #371432: Exposing the flaggings table: Alternative Views support patch gets committed. So I think this issue should be marked a duplicate.
Comment #14
mitchell commentedMarking as a duplicate of #371432: Exposing the flaggings table: Alternative Views support.