Bender: Ahhh, what an awful dream. Ones and zeroes everywhere... and I thought I saw a two.
Fry: It was just a dream, Bender. There's no such thing as two.

Fresh from my blog...

Creating a list of total flags per user

Posted by Bill Seremetis on Tue, 11/25/2014 - 14:52
Drupal: Total flags of type per user

I needed to create a list with the total count of flags, for a specific flag type, made by users. The query to do this for one user is this:
SELECT COUNT(*) FROM flagging WHERE uid=[user_id] AND fid=[flag_id];

Doing this with views, while not very difficult is a bit trivial. You need to start with a node view and not with a user view. From here on things go as follows:

  1.  Add a relationship: Flags Content Flag and set it to the flag type you want. Make sure to check 'by any user'. Do net check 'include only flagged content'.
  2. Then add a relationship: Flags User and set its relationship to be the one from the first step. Check 'require this relationship'.
  3. Enable aggregation from the advanced settings
  4. Add a field in the view: User Name (aggregation type: group results together)
  5. Add a field: Content Title, with aggregation set to COUNT.
  6. Display the results in a table or filter them any way you want, you view is ready.

Attached is a txt export for such a view. It will not work directly on your site, so if you decide to use it, import it bypassing validation and then update the relationships to match your sites configuration.