function civicrm_uf_misc_match_id_get($params) { civicrm_verify_mandatory ($params,null,array ('uf_id')); $ufID = CRM_Utils_Array::value( 'uf_id', $params ); return civicrm_uf_match_id_get($ufID); }
static function contactID($ufID) { require_once 'api/v2/UFGroup.php'; $contactID = civicrm_uf_match_id_get($ufID); if ($contactID) { return $contactID; } // else create a contact for this user $user = user_load(array('uid' => $ufID)); $params = array('contact_type' => 'Individual', 'email' => $user->mail); require_once 'api/v2/Contact.php'; $values = civicrm_contact_add($params); if ($values['is_error']) { CRM_Core_Error::fatal(); } return $values['contact_id']; }
function testGetUFMatchIDWrongParam() { $result = civicrm_uf_match_id_get('a string'); $this->assertEquals($result['is_error'], 1); }