Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
webform_mailchimp 7.x-4.x-dev does not handle interest groups appropriately per API v.3. Currently, no components exist to map the group name to it's corresponding Mailchimp ID. Reworking the way groupfields are created and using the group ID as opposed to the group label seems to fix the issue.
Mailchimp Webform Field Config:
Mailchimp interest fields:
"Mailchimp Interest Group Name"|"Webform Field Key" (checkboxes or dropdown)
Webform Options Field:
"Mailchimp group ID"|"Human Readable Label"
Currently running:
mailchimp 7.x-4.7
webform_mailchimp 7.x-4.x-dev
webform 7.x-4.14
Comment | File | Size | Author |
---|---|---|---|
#8 | Schermafbeelding 2018-11-13 om 09.29.05.png | 121.57 KB | meez |
#8 | Schermafbeelding 2018-11-13 om 09.19.16.png | 128.85 KB | meez |
#6 | webform_mailchimp_interest_group_2835917_6.patch | 3.39 KB | achton |
Comments
Comment #2
daniyar.seferov CreditAttribution: daniyar.seferov as a volunteer commentedSame patch with pre-built option list of Mailchimp groups [list_name]: [group_name]
Comment #3
AlejandroSalinas9294 CreditAttribution: AlejandroSalinas9294 commentedComment #4
Baysaa CreditAttribution: Baysaa as a volunteer commentedThe patch at #2 works. Adds a nice mailchimp interest groups "Pre-build option list" to a Webform "Select options" type form component.
The only thing for me was that our organisation uses a lot of hidden interest groups, and the mailchimp_get_lists() function skips "hidden" interest groups which was not ideal for my use-case. The only way to change that was for me to copy the mailchimp_get_lists() function and paste it into this module as webform_mailchimp_get_lists(), and remove the logic to skip hidden interest groups.
I could've added this as a configuration, but this module doesn't have any config forms at the moment, and making a whole new interface just for 1 checkbox seemed like an overkill, so I'm just going to continue using my own patch for my own use-case and not post it here.
Comment #5
millionleaves CreditAttribution: millionleaves as a volunteer and commentedPatch in #2 works for me, and the "Pre-built option list" is very handy. I don't have any hidden interest groups on this particular site.
I'm assuming the interest group IDs are now required (by the Mailchimp API) for interest group fields to function. I'm not sure where I would have obtained those IDs from without this patch. Would be good to see it committed, and have some instructions on how to use the Pre Built Option" feature documented on the main module page.
Comment #6
achtonThe patch in #2 was not formatted as a p1 patch, so adding an updated patch here which applies cleanly. No change otherwise.
Comment #7
d.bipes CreditAttribution: d.bipes commentedBaysaa,
Do you mind sharing the code you changed to do this?
Comment #8
meez CreditAttribution: meez commentedI applied patch #2 and I can see the file
webform_mailchimp.module
has been changed. But it looks like on the Webform configuration page I don't see any changes. I also get this error:Status code 400. "400: Invalid Resource - Invalid interest ID: '77927'."
?In webform_mailchimp field configuration I have (see attachment):
Mailchimp merge fields:
Mailchimp interests fields:
Gender|field_sexe
In webform component radio buttons
field_sexe
I have (see attachment):Man
Woman
What I am doing wrong here?
Comment #9
johanvdr CreditAttribution: johanvdr commentedI see in Comment #2 that a pre-build list can be build with Interest Groups available in the checkbox/dropdown component. That works ok. Is that all you need?
The pre-build list gets the key/value pairs.
Do you still need to do add anything than to Mailchimp interests fields in the webform mailchimp component (or is that already taken care off)?
Comment #10
branram CreditAttribution: branram commentedI've tried rolling the two versions of this patch in #2 and #6 but neither seem to be populating any interest group lists in the mailchimp field webform component settings. The "Mailchimp interests fields" still an open text area field. And unfortunately since Mailchimp decided to sunset their developer playground, I don't have an easy way to manually find the group id I need. I'm not sure if I'm doing something wrong or if there have been new requirements from Mailchimp since this patch was created.