add a condition to check if the value is 1

This commit is contained in:
Marc Michalsky 2024-06-11 13:00:12 +02:00
parent ab5d0906d7
commit 4432060d05
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -533,6 +533,7 @@ function civicrm_api3_twingle_donation_Submit($params) {
if (
(bool) $profile->getAttribute('newsletter_double_opt_in')
&& isset($params['newsletter'])
&& 1 == $params['newsletter']
&& is_array($groups = $profile->getAttribute('newsletter_groups'))
) {
$group_memberships = array_column(
@ -573,6 +574,7 @@ function civicrm_api3_twingle_donation_Submit($params) {
}
elseif (
isset($params['newsletter'])
&& 1 == $params['newsletter']
&& is_array($groups = $profile->getAttribute('newsletter_groups'))
) {
foreach ($groups as $group_id) {
@ -592,6 +594,7 @@ function civicrm_api3_twingle_donation_Submit($params) {
// If requested, add contact to postinfo groups defined in the profile.
if (
isset($params['postinfo'])
&& 1 == $params['postinfo']
&& is_array($groups = $profile->getAttribute('postinfo_groups'))
) {
foreach ($groups as $group_id) {
@ -609,6 +612,7 @@ function civicrm_api3_twingle_donation_Submit($params) {
// (see issue #83)
if (
isset($params['donation_receipt'])
&& 1 == $params['donation_receipt']
&& is_array($groups = $profile->getAttribute('donation_receipt_groups'))
) {
foreach ($groups as $group_id) {