You are here

public function EventAnEnrollService::tokenExists in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php \Drupal\social_event_an_enroll\EventAnEnrollService::tokenExists()
  2. 8.5 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php \Drupal\social_event_an_enroll\EventAnEnrollService::tokenExists()
  3. 8.6 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php \Drupal\social_event_an_enroll\EventAnEnrollService::tokenExists()
  4. 8.7 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php \Drupal\social_event_an_enroll\EventAnEnrollService::tokenExists()
  5. 10.3.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php \Drupal\social_event_an_enroll\EventAnEnrollService::tokenExists()
  6. 10.0.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php \Drupal\social_event_an_enroll\EventAnEnrollService::tokenExists()
  7. 10.1.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php \Drupal\social_event_an_enroll\EventAnEnrollService::tokenExists()
  8. 10.2.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php \Drupal\social_event_an_enroll\EventAnEnrollService::tokenExists()

Returns number of anonymous enrollments.

Parameters

string $token: Token to validate.

int $nid: The node ID.

Return value

bool TRUE if token exists, FALSE otherwise.

1 call to EventAnEnrollService::tokenExists()
EventAnEnrollService::isEnrolled in modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php
Checks if a visitor is enrolled.

File

modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollService.php, line 84

Class

EventAnEnrollService
Class EventAnEnrollService.

Namespace

Drupal\social_event_an_enroll

Code

public function tokenExists($token, $nid) {
  $query = $this->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);
}