Hey guys!

Super module!
I used the regular embed code from Mailchimp before, but that gave our subscribers an extra email.
With this module that is not the case anymore. Cool.

The only downside is that I cannot add a language to the email address, which is inconvenient when on a multilingual website.

It only gives me options:
MERGE FIELD DISPLAY
Email Address
First Name
Last Name

So, what is the trick to add default field "language" to the list?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yvesvanlaer created an issue. See original summary.

codewhisper’s picture

Hy there,

I have created a patch which sets the current language automatically. Developer can just add the language as a new parameter to mailchimp_subscribe.

codewhisper’s picture

File mailchimp-language-parameter-2794365-1.2.patch should be applied to current stable version 1.2

codewhisper’s picture

Status: Active » Needs review
LilyB’s picture

As previous patch doesn't work for version 1.3.The updated patch is: mailchimp-language-parameter-2794365-1.3.patch.
(Also was added 'Accept-Language' header dependent on the subscription language parameter. Wich allows confirmation mails to be translated.)

mariusdiacu’s picture

Settings the default language only in modules/mailchimp_signup/src/Form/MailchimpSignupPageForm.php forces any other modules implementing mailchimp to send the language if they want this feature. For example, webform_mailchimp uses this module. It creates an email handler to subscribe to a mailchimp list instead of email sending.

Also, changes in lib/mailchimp-api-php/src/Mailchimp.php should be maintained by https://github.com/thinkshout/mailchimp-api-php

Isn't better to set the language directly in mailchimp_subscribe?

mariusdiacu’s picture

codewhisper’s picture

@mariusdiacu you are right. I changed your patch slightly to have mailchimp_subscribe_process with an optional language parameter.

@LilyB I am not sure, that the Accept-Language header is needed. I can't find it in the API documentation. Can you share a link? Anyhow mariusdiacu is right. The changes should be made in the mailchimp lib directly.

https://github.com/thinkshout/mailchimp-api-php

das-peter’s picture

Just come across the same issue with the 7.x-5.x branch and opted for the same approach.
Patch for 7.x-5.x attached.
Unfortunately the 7.x-5.x branch doesn't seem to be enabled for automated testing, so I disabled that for this patch.

samuel.mortenson’s picture

Assigned: Unassigned » rjacobsen0
rjacobsen0’s picture

Nice patch! Rerolling it to apply to updated codebase. Will check it in.

  • rjacobsen0 committed 8c0bba6 on 8.x-1.x authored by codewhisper
    Issue #2794365 by codewhisper, mariusdiacu, rjacobsen0, LilyB, das-peter...
rjacobsen0’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.