Closed (fixed)
Project:
Flag
Version:
6.x-2.x-dev
Component:
Flag core
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Aug 2010 at 22:35 UTC
Updated:
1 Nov 2010 at 23:04 UTC
I can't (as the administrator) remove other users' flags (or clear them) using Views.
How can I remove flags from other users with Views?
I don't want to reset all the flags for a node, but I want to remove a user's flag on a particular content.
Comments
Comment #1
quicksketchThis is not generally possible (for a variety of reasons). See #593300: Changing a different user's node flags.
Comment #2
Alcaparra commentedOk, thanks.
I found the module "Views Custom Field". This module can add a field with php code. Can you help with code?
Views Custom Field: http://drupal.org/project/views_customfield
Comment #3
quicksketchI can refer you to the Flag API: http://drupal.org/node/305086. You probably just want to call the flag() function: http://api.lullabot.com/flag
Comment #4
Alcaparra commentedThank you quicksketch. This is the comment in "Views Custom Field" Issues. Maybe you can help:
http://drupal.org/node/890036
Comment #5
Alcaparra commentedI tried:
but nothing happens. Do you know what is the problem?
Comment #6
mooffie commentedAlcaparra, the main problem with your code is that it runs automatically when you view the page. You want the code to run only after you explicitly click some link.
I asked for help at the Rules project, perhaps they can help us.
(Nate, #871064: Making flaggings fieldable will probably introduce this feature, but I prefer not to talk about this yet because unless you see the code, which is quite simple, you might get the impression I plan some code bloat.)
Comment #7
Alcaparra commentedI try to make a module for this problem. Can you help me? http://drupal.org/node/890910
Comment #8
mooffie commentedIt's easier to write the module than to teach/fix another. Perhaps I'll try to do it later this day/week, but I'm engaged in other things so I don't want to promise.
Comment #9
mooffie commentedAre you still looking or this functionality?
I wrote a little module to do this. But I now see that there are gazillions of patches here intending to do similar things (I'm most of the day off-line, so couldn't check).
Comment #10
mooffie commented(You emailed me that you're still interested.)
You can download the module here:
http://github.com/mooffie/flag_clear/archives/master
Important: the module requires the most recent version of Flag, known as 'dev', which you can download here:
http://drupal.org/node/576390
(You will see strange errors if you don't use the 'dev'.)
========
After installing this module you'll find a new field, "Flags: Remove link". (There's also a Reset link.) You'll see it after you bring in the "Flags: Node flag" (or "Flags: Comment flag", or whatever) relationship, as usual.
If you encounter problems, let us see your exported view.
========
(If any programmer here is interested in maintaining this module, let me know.)
Comment #11
mooffie commentedIn case you're a Drupal novice, here are instructions:
After extracting the 'dev' version you'll have to click the button on Drupal's Modules page. This clears Drupal's cache. Then, if you can edit your flags' settings, and flag and unflag content, it means all is fine.
Comment #12
Alcaparra commentedI'm using Flag 6.x-2.0-beta3 and your module seems to work well. What is the problem you've had ("You will see strange errors if you don't use the 'dev'."?
One suggestion, it would be nice if we could choose the type of link (JavaScript toggle, Normal link or Confirmation form) or to use flag link settings.
Thank you very very much for sharing your module ;)
Comment #13
mooffie commentedThis moule provides two links:
1. Removing one flagging ("Remove link").
2. Removing all flaggings ("Reset link").
The first link, which you're using, indeed doesn't necessitate the 'dev' version.
But the second one, the reset link, does require the 'dev' version because is has the following line of code:
This '%flag' thing is only in 'dev'.
The reason the links don't use JavaScript is because a refresh of the whole view is necessary (because the entire table row should go), and our current JavaScript doesn't (and shouldn't) handle this. But I'm aware of this glitch.
Comment #14
Alcaparra commentedthanks for responding so quickly. your module is great.
Comment #15
mooffie commentedThe module now has a homepage at Flag Clear. I'm closing this issue.