A custom Drupal 10 module that allows administrators to configure events and users to register for them with validation, email notifications, and admin reporting.
- Event Configuration: Admins can create and manage events with registration windows.
- User Registration Form: Public form with AJAX-based dependent dropdowns.
- Validation Rules: Email validation, duplicate registration prevention, and input sanitization.
- Email Notifications: Confirmation emails to users and optional admin notifications.
- Admin Reporting: Filter registrations by event/date and export data as CSV.
- Access Control: Admin-only pages secured with custom permissions.
- Core-Only: Built using Drupal core APIs (no contrib modules).
- Drupal 10.x
- PHP 8.1+
- MySQL / MariaDB
- Drush
- DDEV (recommended for local development)
-
Enable the Module
From the project root:
ddev drush en event_registration -y
-
Clear Cache
ddev drush cr
-
Assign Permissions:
Go to Admin → People → Roles
Grant View event registrations permission to the Administrator role
Admin Pages
- Event Configuration Form:
/admin/config/event-registration
- Admin Email Settings:
/admin/config/event-registration/settings
- Admin Registration Listing & CSV Export:
/admin/event-registrations
User Pages
- Event Registration Form:
/event/register
The module uses two custom database tables to store event and registration data.
This table stores the event details configured by the administrator.
| Field | Description |
|---|---|
| id | Primary key |
| event_name | Name of the event |
| category | Category of the event |
| registration_start_date | Registration start date (timestamp) |
| registration_end_date | Registration end date (timestamp) |
| event_date | Event date (timestamp) |
| created | Record creation timestamp |
This table stores user registration details for events.
| Field | Description |
|---|---|
| id | Primary key |
| event_id | Foreign key referencing event_registration_event |
| full_name | User full name |
| User email address | |
| college_name | College name |
| department | Department name |
| created | Registration timestamp |
The following validation rules are implemented in the event registration form:
- All form fields are required and validated using Drupal Form API
- Email format is validated using
FILTER_VALIDATE_EMAIL - Text fields allow only alphabets and spaces
- Duplicate registrations are prevented using:
Email + Event ID
- Users can register only within the configured registration start and end dates
- User-friendly validation messages are displayed for all errors
Email notifications are implemented using the Drupal Mail API.
- Emails are triggered after a successful event registration
- A confirmation email is sent to the registered user
- An admin notification email is sent if enabled in configuration
- Admin email address and notification toggle are managed using Drupal Config API
- Email content includes:
- User Name
- Event Name
- Event Date
- Event Category
- Admin users can view all registrations at:
/admin/event-registrations
- Registrations can be filtered by:
- Event Date
- Event Name (AJAX-based)
- Total number of participants is displayed
- Registration details are shown in a tabular format
- Admins can export filtered registrations as a CSV file
- CSV includes the following fields:
- Name
- Event Name
- Event Date
- College Name
- Department
- Submission Date