[#26] set membership campaign

This commit is contained in:
B. Endres 2020-05-26 11:49:15 +02:00
commit 29c3b04754

View file

@ -698,10 +698,15 @@ function civicrm_api3_twingle_donation_Submit($params) {
$membership_type_id = $profile->getAttribute('membership_type_id'); $membership_type_id = $profile->getAttribute('membership_type_id');
} }
if (!empty($membership_type_id)) { if (!empty($membership_type_id)) {
$membership = civicrm_api3('Membership', 'create', array( // create the membership
$membership_data = [
'contact_id' => $contact_id, 'contact_id' => $contact_id,
'membership_type_id' => $membership_type_id, 'membership_type_id' => $membership_type_id,
)); ];
if (!empty($params['campaign_id'])) {
$membership_data['campaign_id'] = $params['campaign_id'];
}
$membership = civicrm_api3('Membership', 'create', $membership_data);
$result_values['membership'] = $membership; $result_values['membership'] = $membership;
// call the postprocess API // call the postprocess API