Quickly build event registration site with Drupal 7

In one of our projects, we needed a Drupal solution for event registrations. We had events with multiple occurrences (dates) and needed to allow multiple registrations for each user and control allocation of free slots. We've decided to use Drupal with Entity Registration module. It's great solution, but you must keep in mind a few important issues.

Registration state access control

By default, Entity Registration supports registration states, like "pending", "cancelled" and "complete". You can easily define new states. In our case, each new registration should initially get "pending" state and be changed to "complete" (or better - "confirmed") by administrator. Unfortunately, there was no access control for state field; in effect there was no good way to disallow users changing their state to "complete".

There were some workarounds for this issues, including use of taxonomies and field-level permissions (see this issue for details). But we've decided to implement another approach - create additional "Edit registration state" permission for each registration type. The patch was published in Drupal issue queue.

Multiple date field

Our initial data model assumed that we have "event" content type and "date" field with unlimited occurencies (each event occurs many times). Unfortunately, it turned out to be impractical - in this model registrations are bound to the event. In practice it was a bad solution - we weren't able to control free slots (free slots were managed on event level, not date level) ; it was also hard to make a relation between registration and proper event date.

To fix this, we decided to change data model. Currently we have "event" content type, "event date" content type and relationship between "event" and "event date". This solution works great :).

Multiple registrations

To register multiple people with one registration form, you should use Field Collection module. This way you can collect data about several participants. In addition, you should enable "Allow multiple registrations" option in registration field configuration (to add registration functionality to content type, you simply add "Registration" field to it) and use some custom code to automatically update "Slots" field. Example function (must be placed inside a module):

function MODULENAME_field_attach_submit($entity_type, $entity, $form, &$form_state) {
if ($entity_type == 'registration') {
$entity->count = count($entity->field_participants['und']);
}
}

Summary

Our site works smoothly with Entity Registration module. That said, we must admit that this module is quite unstable and needs development experience. But we hope it will mature soon and allow even non-programming people to build complex registration mechanisms.

Comments (3)

Lukasz
says:

Registration State Access Control patch was committed to the repository and is now part of 7.x-1.x-dev build.

Could you briefly explain how you create the relationship and display between the event and event date content types.

Lukasz
says:

For relationships you can easily use Entity Reference and Inline Entity Form modules. Simply add a field to Event content type with unlimited number of values and allow editing it with Inline Entity Form.

Do you have any questions?

Ask us!