Duplicate Flagged Nodes in View
swortis - November 5, 2009 - 05:13
| Project: | Flag |
| Version: | 6.x-1.1 |
| Component: | Views integration |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I'm getting duplicate flagged nodes appearing in a view. The view is simple enough: No arguments; no fields (node view); a variety of content types. Nodes flagged by any user (flag is global) are filtered through and should appear.
However if a user flags a node for inclusion in the view, the user sees the node appear twice in the view. Actually any user that has flagged any node sees the duplicates. Users that have not flagged any nodes do not see the duplicates.
Has anyone seen this behavior? Where would I start to find a solution?
Thanks!

#1
This sounds like a configuration problem with your view. Could you post an export (preferably as an attachment)? I'd suggest removing fields one-by-one until the duplication disappears. You might also try using the "Distinct" option under the view settings.
#2
"Distinct" appears to have worked. Thanks, great tip. I never noticed it before.
(Attaching export of the view as someone may see something strange there.)
#3
I can't see any problems with the view itself, unless your flag "front_page" was an individual-user flag first, then you changed it to global later (or vice-versa). Another good debugging test is looking at the query that Views generates (it's down at the bottom of the view configuration page), and run it in a normal mySQL terminal or in PHPMyAdmin. If you get duplicate rows in the SQL result, you'll get duplicate rows in Views.
Then again, adding distinct fixes any of these problems, but from the looks of your configuration, it shouldn't really be necessary.
#4
Well regardless distinct has fixed the problem. Please reopen if there are further questions about your duplicate entries.
#5
The flag was indeed originally a individual-user flag. I noticed the error, went back and changed it to global, noticed some unexpected behavior and so uninstalled flag and reinstalled it. Perhaps the flags table never was removed?
Anyway, as you say choosing 'distinct' has solved it. Very much appreciate the guidance!
#6
Automatically closed -- issue fixed for 2 weeks with no activity.