Closed (fixed)
Project:
Flag
Version:
6.x-2.x-dev
Component:
Views integration
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Oct 2008 at 18:07 UTC
Updated:
8 Dec 2010 at 08:07 UTC
First of all, Flag has been a great module. I hope to implement it publicly very soon.
I'm wanting to create a list of nodes that have been flagged by a group of people...in this case, my friends through the User Relationships Module.
To test it, I tried to pass a list of UIDs to the view through the argument handling code:
$args[0] = "1+2+3+4"; // UIDs of my Friends
return $args;
However, the argument for "Flags 'x' for UID" is only accepting the first UID, #1.
Is there a way to fetch the flags of multiple users using views?
Comments
Comment #1
ipllc commentedI've been working on this with no further solution for over a week now. I would be much appreciative if someone could help me out.
Example:
I have three friends: Friend A, Friend B, and Friend C. Each have flagged two unique stories. So, I'd like to see all of the stories my friends have flagged. This would result in a view displaying 6 flags.
I'm not looking nodes they've authored, but rather nodes they've flagged.
Can you provide any further insight on how to display a view of multiple users' flags (per-user flags)? I want to use the argument "This argument allows users to filter a view to nodes flagged with the 'x Finds' flag for the specified user." but I need "users" (plural), not "user" (singular).
Thanks!
Comment #2
quicksketchAs you've probably noticed, our Flag argument does not have support for multiple IDs (unlike the taxonomy argument handler). So what you've been trying to do isn't currently possible, the Views integration needs to be enhanced to support such functionality. So I'm changing this to a feature request.
Erm. I just noticed that this is a Drupal 5 installation. It's unlikely that the Drupal 5 version will receive further updates to its Views integration. I'll leave this open though, we should at least ensure that this is possible in Drupal 6 with Views 2.
Comment #3
ipllc commentedThanks, Quicksketch.
Would this be possible with a custom query to the DB in the view?
Alternatively, would it be possible to fast track this feature request as if it were contract work? I guess my only stipulation would be that it would need to work for D5 since that's what we're using. It could be contributed to the module for future use by everyone...
Comment #4
ipllc commentedOkay, I took a stab at this but I'll probably need someone else to clean it up a bit.
The query function in views_query.inc is set to receive multiple values for the uid if you send it an array. Right now, in flag.views.inc on line 294 you have:
$uid = intval($arg);This limits the ability to pass a string of comma-delimited uids like "1,2,456,982".
What I did was comment out the line above and replace the following line:
$joininfo['extra']['uid'] = $arg;with:
This is working well for me, allowing me to pass a string of uids as an argument like this: http://mydomain.com/flags_of_users_view/1,2,456,982/ which lists the flags of multiple users.
Thoughts? I'm not a pro so I couldn't apply a patch...but hopefully this will help with someone else who's trying to pass multiple uids as an argument.
Comment #5
mitchell commentedComment #6
mitchell commentedComment #7
quicksketchAny changes will only happen to the 2.x version, where any new features are being added. This code isn't in any way applicable to Drupal 6 Views, so I'm removing the needs review status.
Comment #8
jday commentedI need to create a feed of all users and their flagged content, I take it this is not possible at the moment. I've read other posts that talk about exposing the flag table, would that make creating a view like this possible?
Comment #9
mooffie commentedThis issues was originally filed against Views 1.x.
I'll assume nowadays constructing this view is already possible, so I'm closing this.
(Anybody: re-open if I'm wrong.)