The onAfterCancelRegistration handler (added in LiveWhale Calendar 3.2.0) fires immediately after a registrant’s RSVP to an event is cancelled — whether cancelled by the registrant themselves, by a staff member in the Manager, or as a result of the event itself being cancelled or deleted.
The handler only passes IDs, not the full registration record, so you may want to look up any additional details you need from the livewhale_events_registrations and livewhale_events tables.
$_LW->REGISTERED_APPS['my_app']=[
'title'=>'My App',
'handlers'=>['onAfterCancelRegistration'],
];
class LiveWhaleApplicationMyApp {
public function onAfterCancelRegistration($cancel_id, $event_id) {
global $_LW;
if ($registration=$_LW->dbo->query('select', 'firstname, lastname, email', 'livewhale_events_registrations', 'cancel_id='.$_LW->escape($cancel_id))->firstRow()->run()) {
if ($event=$_LW->dbo->query('select', 'title', 'livewhale_events', 'id='.(int)$event_id)->firstRow()->run()) {
// e.g. notify staff, update an external system, adjust a waitlist, etc.
$_LW->d_messages->sendMail('staff@example.edu', $event['title'].': Registration Cancelled', $registration['firstname'].' '.$registration['lastname'].' ('.$registration['email'].') has cancelled their registration.');
};
};
}
}
| Argument | Description |
|---|---|
$cancel_id
|
The ID of the cancellation record, used to look up the (now-cancelled) registration in livewhale_events_registrations
|
$event_id
|
The ID of the event the registration belonged to |
Notes
- This handler fires after the registration has already been cancelled — it’s not intended for validation or for preventing the cancellation. Use
onBeforeDeleteif you need to block the action. - This fires for cancellations triggered directly by a registrant or manager, as well as cancellations that cascade from an event being cancelled or deleted.
LiveWhale Support