mail, 'Drupal'); $contactID = CRM_Core_BAO_UFMatch::getContactId($ufID); if (!$contactID) { throw new CRM_Core_Exception('no contact found'); } return $contactID; } /** * @param string $source * @param string|null $title * @param bool $abort * * @return null|string * @throws \CRM_Core_Exception */ public static function groupID($source, $title = NULL, $abort = FALSE) { $query = " SELECT id FROM civicrm_group WHERE source = %1"; $params = [1 => [$source, 'String']]; if ($title) { $query .= " OR title = %2"; $params[2] = [$title, 'String']; } $groupID = CRM_Core_DAO::singleValueQuery($query, $params); if ($abort && !$groupID ) { throw new CRM_Core_Exception('no group found'); } return $groupID; } }