Problem/Motivation
Lately we noticed that even if just a few interest groups have been selected in webform submit handlers, users are subscribed to all interest groups available.
mailchimp_subscribe_process() looks for enabled interst groups like:
foreach ($interests as $interest_group) {
foreach ($interest_group as $interest_id => $interest_status) {
$selected_interests[$interest_id] = ($interest_status !== 0);
}
}
Currentlty webform mailchimp schema type for interest is string, making this always TRUE.
Proposed resolution
Filter out interest groups that have not been selected when saving the settings.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2935916-4-interest-group-schema-type.patch | 1.22 KB | primsi |
| #2 | 2935916--weboform-mailchimp--interest-group-schema-type.patch | 465 bytes | primsi |
Comments
Comment #2
primsi commentedComment #3
berdirI suspect what we are currently storing there is just the default result of #type checkboxes?
The recommended approach is that you run that through array_values(array_filter(), so you get this as result:
- group1
- group2
Then you don't need to check the value anymore at all, you can simply work with the list of values.
That would then definitely need an update function, however.
Comment #4
primsi commentedFollowed the approach from above "mostly" :)
Comment #5
berdirUpdated issue summary and title. Looks good to me.
Comment #6
miro_dietikerCommitted with empty array init. :-)