You are here

function civicrm_entity_action_load_create_contact in CiviCRM Entity 7

Same name and namespace in other branches
  1. 7.2 civicrm_entity.module \civicrm_entity_action_load_create_contact()

Parameters

$user:

null $email:

Return value

mixed

1 string reference to 'civicrm_entity_action_load_create_contact'
civicrm_entity_rules_action_info in ./civicrm_entity.rules.inc
Implements hook_rules_action_info().

File

./civicrm_entity.module, line 836
Implement CiviCRM entities as a Drupal Entity.

Code

function civicrm_entity_action_load_create_contact($user, $email = NULL) {
  try {
    return civicrm_entity_action_load_contact($user);
  } catch (CiviCRM_API3_Exception $e) {
    $ufMatch = CRM_Core_BAO_UFMatch::synchronizeUFMatch($user, $user->uid, $email ? $email : $user->mail, 'Drupal', FALSE, 'Individual');
    $entities = entity_load('civicrm_contact', $ufMatch->contact_id);
    return array(
      'civicrm_contact' => reset($entities),
    );
  }
}