function social_event_an_enroll_token_exists in Open Social 8.4
Same name and namespace in other branches
- 8.3 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_token_exists()
Returns number of anonymous enrollments.
1 call to social_event_an_enroll_token_exists()
- EventAnEnrollActionForm::buildForm in modules/
social_features/ social_event/ modules/ social_event_an_enroll/ src/ Form/ EventAnEnrollActionForm.php - Form constructor.
File
- modules/
social_features/ social_event/ modules/ social_event_an_enroll/ social_event_an_enroll.module, line 151 - The Social event AN enroll module.
Code
function social_event_an_enroll_token_exists($token, $nid) {
$query = \Drupal::database()
->select('event_enrollment__field_token', 'eeft');
$query
->join('event_enrollment__field_event', 'eefe', 'eeft.entity_id = eefe.entity_id');
$query
->condition('eeft.field_token_value', $token);
$query
->condition('eefe.field_event_target_id', $nid);
$results = $query
->countQuery()
->execute()
->fetchField();
return !empty($results);
}