I've been struggling with the D6-beta6 version of flag module for a few hours now, trying to get an admin view working. I've created a 'mark as offensive' flag, for users to easily report the posting of offensive content on the site. The flag is working great on the end-user side.

I'm trying to create an admin-only view that lists all offensive flaggings from all users on the site. The idea is that an admin goes through the list, inspects the nodes that have been marked as offensive, takes some action (either edits, deletes, or leaves as-is the node in question), and then removes the flagging. However, the 'flag link' view field, which supposedly allows any flag to be set/unset, actually only works for the current user's flags.

After some deeper inspection, it seems that the entire underlying Flag API only supports the flagging and unflagging of the current user's content. The flag_flag() function, and all of the lower-level functions/methods that it relies on, are completely devoid of a $uid argument. Information about the user who set a particular flag is not loaded into the $flag object, and is not available anywhere in the API. As such, my simple request (allowing an admin to unset another user's flaggings through a view field) seems to be ridiculously difficult to achieve. Am I missing something, or is this really how the module is designed?

Can I please kindly request that you at least modify the API to pass down the uid of the flagger into the $flag object, and that you allow the flag_flag() function to accept a uid as an argument. In the meantime, any suggestions for how to achieve my use case would be appreciated.

Comments

mooffie’s picture

it seems that the entire underlying Flag API only supports the flagging and unflagging of the current user's content.

That isn't correct. All flagging functions (the $flag->flag() method, or the flag() function) accepct an $account parameter, which is the user on whose behalf to flag/unflag. See the API section in the handbook.

I'm trying to create an admin-only view that lists all offensive flaggings [...]
[...] and then removes the flagging. However, the 'flag link' view field [...] actually only works for the current user's flags.

That's very correct. This is a limitation in this module: it doesn't provide a User Interface for clearing all users' flaggings. This has been discussed before:

#327901: Action: clearing a node's flaggings

(So I guess this issue, Jaza's, should be marked 'duplicate'.)

my simple request (allowing an admin to unset another user's flaggings through a view field)

To focus the discussion I should explain that there are two different feature requests:
1. Allow to clear all flaggings (via the user interface).
2. Allow to clear a specific user's flagging (via the user interface).

You've just asked for #2, but #1 would work in your case as well and I think is easier to implement.

quicksketch’s picture

Status: Active » Closed (duplicate)

Yep, I agree. Let's focus on #327901: Action: clearing a node's flaggings.