You are here

public function Registration::registrant_type in Entity Registration 7

Determine registrant type relative to a given account.

@object $account A Drupal user

Return value

string|NULL Can be me, user, anon or NULL if account is empty and no anon email set.

File

lib/registration.entity.inc, line 204
Entity hooks and callbacks for registrations.

Class

Registration
Main class for Registration entities.

Code

public function registrant_type($account) {
  $reg_type = NULL;
  if (!empty($account)) {
    if ($account->uid && $account->uid === $this->user_uid) {
      $reg_type = REGISTRATION_REGISTRANT_TYPE_ME;
    }
    elseif ($this->user_uid) {
      $reg_type = REGISTRATION_REGISTRANT_TYPE_USER;
    }
  }
  if (!empty($this->anon_mail)) {
    $reg_type = REGISTRATION_REGISTRANT_TYPE_ANON;
  }
  return $reg_type;
}