Limit number of event registrations per month I'm creating a membership-based site in D7, using Date, Calendar, and Entity Registration (which was very easy to setup). Only authenticated users may register for an event.

I'm trying to limit the number of events an authenticated user may register for during a certain time period (probably by month or by quarter), and I'm stuck. I created a field called 'Registration Count' for user accounts. And I created a rule that increments the counter when the user registers for an event.

But I'm trying to figure out:


How do I prevent a registration based on the user's current registration count? I got as far as creating a rule that is triggered prior to a registration and checked his current registration count. And I can display a warning, but the registration still goes through. Isn't there an action I can assign that would halt the registration?
How can I reset the registration counter field for all user accounts back to zero at a certain interval? I can't find access to user fields on that broad level.




Adding more details:

I have a node type called "Event". My registrations are entities. This is out-of-the-box functionality for the Entity Registration module, and it was very simple to get it up and running.

Each user has a field called field-registration-count. When a user registers for an event, I have a rule set up as follows:


Event: After saving a new registration
Action: Set value site:current-user:field-registration-count, add offset 1. This increments the user's registration count by 1.


I have another rule:


Event: Before saving a registration
Condition: site:current-user:field-registration-count > 2
Actions: Page redirect, and then Show a Message on Site


On the third registration, the page redirect happens as expected, and the message is displayed, but the registration is still saved. Based on the provided event named "Before Registration", I think I'm tapping in a the right time; I just can't find an action to cancel the registration itself

Note: When a user actually registers, it doesn't create a node. The Entity Registration module creates an entity type instead, and each registration is an entity.
Action to halt registration

Use "Page redirect", with a value for "URL" that could be either one of these:


some special node that you want to display to inform the user that the maximum number of events was reached.
the same URL that the user uses to add the event, combined with "Show a message on the site" whereas the message content provides appropriate information to the user that the maximum number of events was reached.


If that doesn't help/work, then you may want to try a variation of my answer to the question about How to restrict access to a node via node/12 and allow access via a path like content/sometitle? (that question was about "Node is 'going' to be viewed, while yours is about something like "entity is 'going' to be created").

Reset registration counter

Similar to the "Registration Count" field that you added, add another field like "Count start date". And each time a user tries to create a new event, just use that "Count start date" to compare it with the "current date": if then the time span between those 2 dates is longer then that "certain interval", then reset the "Registration Count" to zero.