function registration_waitlist_registration_status_alter in Entity Registration 7
Same name and namespace in other branches
- 8.2 modules/registration_waitlist/registration_waitlist.module \registration_waitlist_registration_status_alter()
- 8 modules/registration_waitlist/registration_waitlist.module \registration_waitlist_registration_status_alter()
- 7.2 modules/registration_waitlist/registration_waitlist.module \registration_waitlist_registration_status_alter()
Implements hook_registration_status_alter().
File
- modules/
registration_waitlist/ registration_waitlist.module, line 83 - Entity Registration waitlist functionality
Code
function registration_waitlist_registration_status_alter(&$status, &$context) {
$entity_type = $context['entity_type'];
$entity_id = $context['entity_id'];
$settings = registration_entity_settings($entity_type, $entity_id);
$capacity = $settings['capacity'];
// Not unlimited capacity
if ($capacity) {
// We only want to check if the wait list is active when the only status error relates to capacity
$capacity_error = FALSE;
if (count($context['errors']) == 1) {
$error = reset($context['errors']);
$capacity_error = $error == t(REGISTRATION_INSUFFICIENT_SPACES_MESSAGE) ? TRUE : FALSE;
}
// Capacity error, return true if the wait list is enabled.
if ($capacity_error && registration_waitlist_is_active($entity_type, $entity_id, $context['errors'])) {
$status = TRUE;
}
}
}