I think this can be done with rules integration and flag, but I can not figure out how to accomplish it.

I need to allow for a flag to be only used once. Basically, any authenticated user can use it but once it has been "toggled" once no one else can use it. Maybe this isn't the right module for this. I looked at Signup, but I'm not sure it restricts to only allowing for a one time use. I need to integrate this with User Points, so flag is preferable. A person flags a node and earns points for taking "ownership" of that node.

I didn't know if I should mark this as a feature request, since it may already be inherent in the current state.

Thank you for any assistance anyone can offer.

Comments

quicksketch’s picture

I need to allow for a flag to be only used once. Basically, any authenticated user can use it but once it has been "toggled" once no one else can use it.

This is not possible (in Flag 1.1) because there is no way to entirely prevent access to a Flag based on certain conditions. You can do tricks to make the link disappear or replace it with some other text by using some custom code, but even then it's not secure on the API side (a user could manually type in a URL for example and still flag content).

This was one of the driving features behind the 2.x version of the module, which provides separate "flag" and "unflag" permissions. I'd suggest trying out the 2.x version (on a back up!) and see if it will work for you. Once upgraded, you'll just need to grant authenticated users "Flag" access, but not "Unflag" access when configuring the flag.

SeedTreeLLC’s picture

I'm in dev so I loaded the 2.x version. I'm still in the same confused state of how to use the Rules integration to restrict the Flag to a one time use. My goal is to allow people to flag a node and gain complete ownership of that node. That would mean that once they flagged it no one else would have the ability to flag it. I guess its like capture the "Flag". Everyone has a chance to get it, but once someone has captured it than it belongs to them. Is this a feature request? Maybe I should look at sponsoring a new submodule...? I could try to write it myself, but that might prove disastrous.

quicksketch’s picture

I'm still in the same confused state of how to use the Rules integration to restrict the Flag to a one time use.

You don't need to use Rules at all, this is a built-in feature that a user can Flag but not unflag. Just make the flag "global", then grant access to "flag" but not "unflag". This makes it so only one user on the site can Flag it. However it does *not* record which user did the flagging, so that's likely going to be a problem. Perhaps that's where Rules can come in and do something for the first user that does the flagging.

SeedTreeLLC’s picture

Seems to me that regardless of whether the flag is global or not that "who" flagged it should be relevant and recorded. I found http://drupal.org/project/flag_note, but I really don't need any notes on it and i'm unsure if it actually keeps a record of which user did the flagging. hmmm. I guess I'm still looking for the best approach. Thank you for you prompt replies. ;D

BenK’s picture

Subscribing....

samiu1287’s picture

Here's what I would do:

1. I would create a flag and make it global. You should grant permission so that anyone can flag it, but no-one can unflag it.

2. On the node the flag is applied, make a cck field 'user reference' that is not required and is not editable on the node creation or node editing page (the field is hidden). To do this, do not grant editing permissions to this field under user '/admin/user/permissions'.

3. Then use rules to complete this field with the user-flagging when the node is flagged with your flag.

That should work.

Tell me if you need more info or if something is unclear.

quicksketch’s picture

Status: Active » Closed (fixed)

Thanks samiu1287 for your input. The last post before yours was 6 months ago, so I'm going to close this issue.