So we create an activity when a contact 'refers a friend', we want it on both users Contact. This is working thus:
$activity = civicrm_api(
'Activity',
'create',
array(
'version' => 3,
'sequential' => 1,
'activity_type_id' => 60, //refer activity
'status_id' => 2, // complete
'source_contact_id' => $post['contactId'],
'target_contact_id' => $contact['contact_id'], //person who created it
'activity_subject' =>
'Referred by a mate: ' . $post['contactId'],
)
);
Works correctly to link the two contacts via the Activity.
But - in the 'With' field, it also adds a second person each time, unrequested. The extra persons contactId increments by 1 each time - which may be a hint.
We've logged all through our code, and through Core trying to find where this is being added, but can't find. Does anyone have any hints on where to look/log for this behaviour?