I have been looking for this feature on drupal.org, and when I saw other people requesting it I thought I might as well give it a try myself and write my first drupal module patch.
What it does: This patch adds a field in the content type settings where one can specify how many signups of that type a user is allowed to signup for. The signup form of a node is not displayed if the user already has signed up for too many node of that type.
Use case: On the site I am working on we have a signup enabled content type called "Audition". Each user is only able to signup for one audition.
The attached patch is enough for our simple site, but there are a few things to be done before this patch is ready to be included in HEAD. I might be looking into some of these in the near future, but I'm not promising anything. So please feel free to try this patch out, but don't expect any miracles =)
To do:
- Validate the limit field to make sure that it is a positive integer
- I'm not sure whether the error message (displayed when a user has reached the limit) is themed correctly
- Anonymous signups are not treated
- An administrator might still be able to add people despite the limit (Is that a good or bad thing?)
I would be very grateful for any feedback on this patch.
| Comment | File | Size | Author |
|---|---|---|---|
| signup_node_type_limit.patch | 3.57 KB | freidrichen |
Comments
Comment #1
osandum commentedExcellent, Magnus. This sounds a lot like what I need, and I will try it out as soon as possible.
One question: in the case at hand, we only need to limit the number of each user's future signups, i.e. signups where the event's start date/time has not yet been reached. As soon as an event starts, the signed-up users should be allowed to sign up for a new (future) event. Is this how your patch works already?
Best regards
Comment #2
freidrichen commentedHmm... come to think of it that's what I want too =)
I'll get around to fixing it in a few days.
//Magnus