You are here

function registration_is_registered in Entity Registration 8.2

Same name and namespace in other branches
  1. 8 registration.module \registration_is_registered()
  2. 7.2 registration.module \registration_is_registered()
  3. 7 registration.module \registration_is_registered()

Determine if a person has an active registration for a host entity.

Parameters

Registration $registration: A fully loaded registration object.

string $mail: (optional) An email address.

Return value

bool

3 calls to registration_is_registered()
RegistrationStandardTestCase::testRegistrationForm in tests/registration.test
Tests for the registration add/edit form.
RegistrationStandardTestCase::testRegistrationForm in src/RegistrationStandardTestCase.php
Tests for the registration add/edit form.
registration_form_validate in includes/registration.forms.inc
Validation callback for registration_form().

File

./registration.module, line 1439

Code

function registration_is_registered(Registration $registration, $mail) {

  // Must provide an email.
  if (!$mail) {
    return FALSE;
  }
  $registrations = registration_get_registrations($registration->entity_type, $registration->entity_id, $mail);

  // Exclude existing registration.
  if (isset($registration->registration_id)) {
    unset($registrations[$registration->registration_id]);
  }
  return count($registrations) > 0;
}