You are here

function pmperson_primary_email in Drupal PM (Project Management) 7

A helper function to return the email address of a pmperson

3 calls to pmperson_primary_email()
pmproject_token_values in pmproject/pmproject.module
Implements hook_token_values().
pmtask_token_values in pmtask/pmtask.module
Implements hook_token_values().
pmticket_token_values in pmticket/pmticket.module
Implements hook_token_values().

File

pmperson/pmperson.module, line 646

Code

function pmperson_primary_email($node) {
  if ($node->type !== 'pmperson') {
    return NULL;
  }

  // If there is a Drupal user account use that email
  if ($node->user_uid) {
    $pmperson_person = user_load($node->user_uid);
    return $pmperson_person->mail;
  }
  elseif ($node->email) {

    // Ignore use of $node->email rather than $node->mail.
    // @ignore coder_tough_love_8
    return $node->email;
  }
}