1

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?

1

So I'm fairly sure this issue was actually a dev environment specific issue. The dev database wasn't using the full 'activity' table (as it was so large) and thus creating some oddities.

If I see it again on a live env I'll have to investigate in future though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.