Posted by cameronmacpherson on November 7, 2009 at 2:36am
Jump to:
| Project: | Flag |
| Version: | 6.x-1.1 |
| Component: | Views integration |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hey,
I'm trying to get a list of user pictures of users who have flagged a certain node, on a view of a listing of those nodes. I have successfully gotten it to show one user picture of the users who have flagged via the flag relationship table, but I need it to show all users (or a set number that have).
So on each node listed in the view, if 30 users have flagged x node, I'd like to show the pictures of each user who flagged, limit 5. Is this easily accomplished through views using a method I'm not thinking of? Right now it only shows only 1 picture of the user, I'd like it to show more.
Is this possible?
Please let me know...
Thanks!
Comments
#1
There is no built-in way to group together multiple pictures or to limit it to just 5 showing. The only thing you can do is show the same row once for every user that has flagged a piece of content. So if you have 5 pieces of content flagged 10 times each, you'll get a listing that has 50 rows (the same node 10 times each, just with different pictures). Doing any sort of "group by X and limit to 5" is something that's just not possible with a single SQL query (without using sub-queries). If you're comfortable with theming you can loop through the results and make them appear as single, grouped rows, but it's likely that you'll end up with an excessive number of entries, since there's still no way to limit to "5 people that have flagged this node", you'll always get all of them.
Something you might try is using the http://drupal.org/project/gallery_summary module, which makes it so that it actually executes one query to build a list of nodes, then another query per row to show a list of who's flagged each node (which you can limit to 5 since now it's doing multiple queries). It's a brand new module so documentation might be a little short.
#2
Hey Quicksketch, thanks for the response. What I think I'm going to do is use views customfield and print views_embed_view() to embed the values, and use the 3rd function to assign the $nid to the node, hence attaching them onto it. Lets hope the query doesen't break my system!
Thanks!
#3
That sounds like plan. A little scary, but a plan ;-).
Internally that's exactly what Gallery Summary does, calling views_embed_view() internally for every row in the results. Sounds like it'll likely work.
#4