Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mailchimp
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
mailchimp
Commits
00fffafc
Commit
00fffafc
authored
1 year ago
by
xenophyle
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3391752
by xenophyle, bdimaggio: Interests are not updated
parent
a746b591
No related branches found
No related tags found
3 merge requests
!60
Issue #3391752: Interests are not updated
,
!35
3.x - Merge Oauth work into 3.x after that work has beeb merged into 2.x
,
!25
Issue #2951089 by thomscode, Guietc: WSOD - Proxy issue
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/mailchimp_lists/mailchimp_lists.module
+42
-11
42 additions, 11 deletions
modules/mailchimp_lists/mailchimp_lists.module
with
42 additions
and
11 deletions
modules/mailchimp_lists/mailchimp_lists.module
+
42
−
11
View file @
00fffafc
...
...
@@ -253,28 +253,59 @@ function _mailchimp_lists_subscription_has_changed(MailchimpListsSubscription $i
// old settings from Mailchimp. This means the only possible change is in our
// interest group settings, so we only analyze those:
else
{
// Current member info:
$member_info
=
mailchimp_get_memberinfo
(
$settings
[
'mc_list_id'
],
$email
);
if
(
isset
(
$member_info
->
merge_fields
->
GROUPINGS
))
{
foreach
(
$member_info
->
merge_fields
->
GROUPINGS
as
$grouping
)
{
if
(
!
isset
(
$choices
[
'interest_groups'
][
$grouping
[
'id'
]]))
{
return
TRUE
;
// Current member info interests exist, whether selected or not:
if
(
!
empty
(
$member_info
->
interests
))
{
foreach
(
$member_info
->
interests
as
$interest_id
=>
$subscribed
)
{
// Current interest is selected on MC:
if
(
$subscribed
)
{
// If no interests are selected in the form, subscription has changed.
if
(
empty
(
$choices
[
'interest_groups'
]))
{
return
TRUE
;
}
else
{
// Subscription has changed if interest is not selected in form.
$selected
=
FALSE
;
foreach
(
$choices
[
'interest_groups'
]
as
$group_id
=>
$group
)
{
if
(
!
is_array
(
$group
))
{
// Standardize formatting of choices:
$choices
[
'interest_groups'
][
$group_id
]
=
[
$choices
[
'interest_groups'
][
$group_id
]
=>
$choices
[
'interest_groups'
][
$group_id
]];
}
// Current interest is selected in form:
if
(
isset
(
$group
[
$interest_id
])
&&
$group
[
$interest_id
])
{
// Found it!
$selected
=
TRUE
;
break
;
}
}
if
(
!
$selected
)
{
return
TRUE
;
}
}
}
// If current interest is not subscribed on MC, check if it is selected
// in the form.
else
{
if
(
!
is_array
(
$choices
[
'interest_groups'
][
$grouping
[
'id'
]]))
{
// Standardize formatting of choices:
$choices
[
'interest_groups'
][
$grouping
[
'id'
]]
=
[
$choices
[
'interest_groups'
][
$grouping
[
'id'
]]
=>
$choices
[
'interest_groups'
][
$grouping
[
'id'
]]];
}
foreach
(
$choices
[
'interest_groups'
]
as
$group_id
=>
$group
)
{
if
(
!
is_array
(
$group
))
{
// Standardize formatting of choices:
$choices
[
'interest_groups'
][
$group_id
]
=
[
$choices
[
'interest_groups'
][
$group_id
]
=>
$choices
[
'interest_groups'
][
$group_id
]];
}
foreach
(
$grouping
[
'groups'
]
as
$group
)
{
$selected
=
isset
(
$choices
[
'interest_groups'
][
$grouping
[
'id'
]][
$group
[
'name'
]])
&&
$choices
[
'interest_groups'
][
$grouping
[
'id'
]][
$group
[
'name'
]];
if
((
$group
[
'interested'
]
&&
!
$selected
)
||
(
!
$group
[
'interested'
]
&&
$selected
))
{
// Current interest is selected in form:
if
(
isset
(
$group
[
$interest_id
])
&&
$group
[
$interest_id
])
{
return
TRUE
;
}
}
}
}
}
// Current member info has no interests selected but form submission does.
elseif
(
!
empty
(
$choices
[
'interest_groups'
]))
{
return
TRUE
;
}
}
// No changes detected.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment