[#5] Create membership when a type is selected in the profile

This commit is contained in:
Jens Schuppe 2019-08-07 11:35:20 +02:00
parent 341a0f0e32
commit 9ffbd5b070

View file

@ -571,6 +571,13 @@ function civicrm_api3_twingle_donation_Submit($params) {
}
$result_values = $contribution['values'];
// Create membership if a membership type is configured within the profile.
if (!empty($membership_type_id = $profile->getAttribute('membership_type_id'))) {
$membership = civicrm_api3('Membership', 'create', array(
'contact_id' => $contact_id,
'membership_type_id' => $membership_type_id,
));
}
$result = civicrm_api3_create_success($result_values);