I am currently testing Flag + Rules as a way for people to register for an event. I have tried RSVP and Signup and this implementation seem to work the best for registered users

Users click a 'Register' Flag then rules checks the count against a cck field (max users) and if this flag count is above that count it removes the flag and displays an "event full" message.

I can then use views and rules to email confirmation to users, display a membership list, etc.

This got me thinking of either a new module or feature within flags so people can expand flag usage to this or something similar without the need for cck or rules. I have not created a module before but will be trying on this (although this may be a lot more than I am capable of). If anyone with more skill wants to take this on please feel free. Please also share your thoughts or concerns on this idea.

The way I see it, it would need the following components.

Options
1) When creating a flag, below Global, a check box for 'restrict flag number'. (maybe even combining all into radios, ie Global, personal, restricted number)
2) New message options available for "Flagged message if full" and "Flagged message if full and flag attempted".
3) If 'restrict flag number' is set, an option is added to the node creation form called 'flag ~name~ max count'. 0 or blank would be unlimited (and the default), any other number entered would be the max count.

Functionality.
1) When rendering a node, flag checks for 'restrict flag number' and 'flag~name~count'. If on and at max count (and not 0), it hides the flag and displays "Flagged message if full" text instead of the flag link
2) When a flag is clicked, flag checks for 'restrict flag number' and 'flag~name~count'.
----If off, or flag count is below flag number count, it adds the flag. (working as is does now).
----If on and flag count is maxed out, the flag is not added and a message is shown to the user "Flagged message if full and flag attempted" (ie, sorry even is now full)

Advanced Functionality.
1) Ideally you could also add and option below 'flag ~name~ count' that offers 2 option.
----Restrict flagging by role
----Restrict flagging by view
2) this would tie into the check above under Functionality 2) to check for access.
(The same functionality in CCK's User Reference)
NOTE: I think this would be a great feature to Flag even without the rest of this functionality.

Views
Flag integration into views already works great. The only addtion that would be nice to expose would be the max count number for node.

Comments

mooffie’s picture

(I think, once #952114: Have hook_flag_validate() is accepted, that all this can be implemented by a contrib module; no change to Flag is needed. But I haven't (yet) read your post thoroughly.)

jeff.k’s picture

I have been playing around with the api and agree that this is likely best as an additional module. hook_flag_validate() would definately make this easier to implement.

mooffie’s picture

Status: Active » Fixed

Jeff, I've re-read your post. It looks like the Flag module itself needs no further tweaking to its API (except #952114: Have hook_flag_validate()), so I'm closing this issue.

You'd still have to use CCK for the "max users" field.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.