$dao = NULL;
if (!empty($_POST) && !$isLogin) {
- $params = $_POST;
- $params['email'] = $uniqId;
+ $dedupeParameters = $_POST;
+ $dedupeParameters['email'] = $uniqId;
// dev/core#1858 Ensure that if we have a contactID parameter which is set in the Create user Record contact task form
- // That this contacID value is passed through as the contact_id to the get duplicate contacts function. This is necessary because for Drupal 8 this function gets invoked
+ // That this contactID value is passed through as the contact_id to the get duplicate contacts function. This is necessary because for Drupal 8 this function gets invoked
// Before the civicrm_uf_match record is added where as in D7 it isn't called until the user tries to actually login.
- if (!empty($params['contactID'])) {
- $params['contact_id'] = $params['contactID'];
+ if (!empty($dedupeParameters['contactID'])) {
+ $dedupeParameters['contact_id'] = $dedupeParameters['contactID'];
}
- $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, 'Individual', 'Unsupervised', [], FALSE);
+ $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($dedupeParameters, 'Individual', 'Unsupervised', [], FALSE);
if (!empty($ids) && Civi::settings()->get('uniq_email_per_site')) {
// restrict dupeIds to ones that belong to current domain/site.
}
if (!$found) {
+ $contactParameters = [];
// Not sure why we're testing for this. Is there ever a case
// in which $user is not an object?
if (is_object($user)) {
else {
$primary_email = $user->email;
}
- $params['email'] = $primary_email;
+ $contactParameters['email'] = $primary_email;
+ }
+ else {
+ CRM_Core_Error::deprecatedWarning('please log how you hit this...');
}
if ($ctype === 'Organization') {
- $params['organization_name'] = $uniqId;
+ $contactParameters['organization_name'] = $uniqId;
}
elseif ($ctype === 'Household') {
- $params['household_name'] = $uniqId;
+ $contactParameters['household_name'] = $uniqId;
}
- $params['contact_type'] = $ctype ?? 'Individual';
+ $contactParameters['contact_type'] = $ctype ?? 'Individual';
// extract first / middle / last name
// for joomla
if ($uf === 'Joomla' && $user->name) {
- CRM_Utils_String::extractName($user->name, $params);
+ CRM_Utils_String::extractName($user->name, $dedupeParameters);
}
if ($uf === 'WordPress') {
if ($user->first_name) {
- $params['first_name'] = $user->first_name;
+ $contactParameters['first_name'] = $user->first_name;
}
if ($user->last_name) {
- $params['last_name'] = $user->last_name;
+ $contactParameters['last_name'] = $user->last_name;
}
}
- $contactId = civicrm_api3('Contact', 'create', $params)['id'];
- $ufmatch->contact_id = $contactId;
+ $contactID = civicrm_api3('Contact', 'create', $contactParameters)['id'];
+ $ufmatch->contact_id = $contactID;
$ufmatch->uf_name = $uniqId;
}