Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-10943

synchronizeUFMatch function improperly detecting conflicts

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.1
    • Fix Version/s: 4.2.3
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      When attempting to work out if there is an existing civicrm contact record to match against a Drupal/Wordpress/Joomla user, the function synchronizeUFMatch() in CRM/Core/BAO/UFMatch.php attempts to to ensure that there aren't duplicates in the uf_match table with the following code:

      <pre>
      $sql = "
      SELECT id
      FROM civicrm_uf_match
      WHERE contact_id = %1
      ";
      $params = array(1 => array($dao->contact_id, 'Integer'));
      $conflict = CRM_Core_DAO::singleValueQuery($sql, $params);
      </pre>

      Unfortunately, this isn't filtering by domain_id, and so if this is a civicrm multisite setup then it's detecting 'conflicts' if there is an existing uf_match entry for a different domain. The following code rectifies this:

      <pre>
      $sql = "
      SELECT id
      FROM civicrm_uf_match
      WHERE contact_id = %1
      AND domain_id = %2
      ";
      $params = array(
      1 => array($dao->contact_id, 'Integer'),
      2 => array(CRM_Core_Config::domainID(), 'Integer'),
      );
      $conflict = CRM_Core_DAO::singleValueQuery($sql, $params);
      </pre>

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              torrance123 Torrance
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: