[#5] Add a setting for differentiating membership types depending on donation rhythm

This commit is contained in:
Jens Schuppe 2020-01-22 12:51:15 +01:00
parent cd7c7e7d12
commit bc9baea6f2
5 changed files with 38 additions and 17 deletions

View file

@ -648,7 +648,13 @@ function civicrm_api3_twingle_donation_Submit($params) {
}
// Create membership if a membership type is configured within the profile.
if (!empty($membership_type_id = $profile->getAttribute('membership_type_id'))) {
if ($params['donation_rhythm'] != 'one_time') {
$membership_type_id = $profile->getAttribute('membership_type_id_recur');
}
else {
$membership_type_id = $profile->getAttribute('membership_type_id');
}
if (!empty($membership_type_id)) {
$membership = civicrm_api3('Membership', 'create', array(
'contact_id' => $contact_id,
'membership_type_id' => $membership_type_id,