*/
public static function &synchronizeUFMatch(&$user, $userKey, $uniqId, $uf, $status = NULL, $ctype = NULL, $isLogin = FALSE) {
$config = CRM_Core_Config::singleton();
-
- if (!CRM_Utils_Rule::email($uniqId)) {
- $retVal = $status ? NULL : FALSE;
- return $retVal;
- }
-
$newContact = FALSE;
// make sure that a contact id exists for this user id
if (!empty($_POST) && !$isLogin) {
$params = $_POST;
$params['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
+ // 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'];
+ }
$ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, 'Individual', 'Unsupervised', [], FALSE);