Hi,

I using the current Mailchimp module 7.x-3.1 on three different sites.
To test, I'm using the same Mailchimp account and List and webhook (api key) for all three sites.

I'm having problems using the Mailchimp Subscription field with site 1 and 2.
=> when I add a Mailchimp subscription field to site 1 and 2:
- I do not get the Merge Fields inside the field settings
- I cannot select a MailChimp list inside the field settings
- I cannot subscribe to a list (because of the previous two points)

All other API communication is running fine, in the admin/config/services/mailchimp/lists I get to see all the lists from the MailChimp account and they are enabled.
When I login in my MailChimp account, and I look at the webhook API communication, I see that there is communication between the sites and MailChimp.

I also tried to add a MilChimp subscription field to a content type, to see if it works over there.
I have added an email field to that content type and tested it over there.
It also does not work but I do see the MailChimp List inside the subscription field settings. When I try to subscribe by creating new content, I get several errors and notices:
- When displaying the node, I get "Invalid email configuration." from the subscription field
- In the error log I get:

Warning: array_key_exists(): The first argument should be either a string or an integer in mailchimp_get_lists() (regel 203 van /var/www/clients/client5/web54/web/tickets/sites/all/modules/mailchimp/mailchimp.module).

Notice: Undefined index: mc_list_id in mailchimp_lists_field_settings_form() (regel 51 van /var/www/clients/client5/web54/web/tickets/sites/all/modules/mailchimp/modules/mailchimp_lists/includes/mailchimp_lists.field.inc).

Notice: Undefined offset: 0 in mailchimp_lists_field_instance_settings_form() (regel 119 van /var/www/clients/client5/web54/web/tickets/sites/all/modules/mailchimp/modules/mailchimp_lists/includes/mailchimp_lists.field.inc).

Mailchimp Lists field "field_chimp" on node -> test has no EMAIL field configured, subscription actions cannot take place.

These are the three websites their configuration:

Site 1:
- Drupal 7.28
- Libraries 7.x-2.2
- Mailchimp Library 2.0.5
- PHP 5.3.3

Site 2:
- Drupal 7.30
- Libraries 7.x-2.2
- Mailchimp Library 2.0.4
- PHP 5.3.10-1

Site 3:
- Drupal 7.26
- Libraries 7.x-2.0
- Mailchimp Library 2.0.4
- PHP 5.3.3
=> this is the only site where the Mailchimp subscription field is working

Does anybody has a clue about what is going wrong here?

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

entrepreneur27’s picture

I have the same issue. I add a subscription field but it does not seem to see any of my lists.

entrepreneur27’s picture

I tried the latest 3.11 mail chimp in the hopes that would help, and also downloaded the older library 2.04 from Mailchimp. I have PHP 5.3.28, Drupal 7.32.

I add a subscription field to my user, and it all goes as expected except that the selector that is supposed to allow you to choose a list is greyed out. This is despite the fact I have a list connected, and a working subscription form that connects happily to Mailchimp.

I do have quite a fe modules on my site, and have tried disabling various ones but nothing seems to change this behavior.

Any tips would be greatly appreciated.

entrepreneur27’s picture

Same problem with Mailchimp 3.2. Get this "warning" in my log:

Warning: array_key_exists(): The first argument should be either a string or an integer in mailchimp_get_lists() (line 204 of /srv/bindings/532802b056d84e9484e7cc0d2f8b70b3/code/sites/all/modules/contrib/mailchimp/mailchimp.module).

ruscoe’s picture

Status: Active » Postponed (maintainer needs more info)
FileSize
129.89 KB

Thanks for the bug report. Did you have any problems selecting a list when you created the subscription field (see attached screenshot) and have the available lists changed at all since creating the field?

entrepreneur27’s picture

Yes. The list select field was greyed out and did not allow me to select a list. However, if I go to the tab where you show lists etc my four available lists show up. So they are there but the subscribe field somehow does not see them.

ruscoe’s picture

Assigned: Unassigned » ruscoe
ruscoe’s picture

Status: Postponed (maintainer needs more info) » Active
dtamajon’s picture

ruscoe,

I have bypass the error modifying mailchimp_get_lists function in mailchimp.module. This is the relevant part of the function, where I haved added a check for the $id variable to be integer or string.

  // Filter by given ids:
  if (!empty($list_ids)) {
    $filtered_lists = array();
    foreach ($list_ids as $id) {
      if (is_numeric($id) || is_string($id)) {
        if (array_key_exists($id, $lists)) {
          $filtered_lists[$id] = $lists[$id];
        }
      }
    }
    return $filtered_lists;
  }
  else {
    return $lists;
  }

For example, when saving the newsletter field in /admin/config/people/accounts/fields/field_newsletter, the $id in the list is an array. Its happening in more places.

I don't know the filter intention here, and maybe this is not the correct solution... so I hope you can verify it.

dobe’s picture

I am receiving this same issue. I also get an error on the user entity: Mailchimp Lists field "field_newsletter_subscriptions" on user -> user has no EMAIL field configured, subscription actions cannot take place.

So as stated above: I cannot select a MailChimp List which I think this is in there on purpose...

function mailchimp_lists_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#field']['type'] == 'mailchimp_lists_subscription') {
    // Disable the list selector on the instance config page:
    <strong>$form['field']['settings']['mc_list_id']['#disabled'] = TRUE;</strong>
    $form['field']['settings']['mc_list_id']['#description'] = t("To alter this list, use the 'Field Settings' tab");
    // Hide the cardinality setting:
    $form['field']['cardinality']['#default_value'] = 1;
    $form['field']['cardinality']['#access'] = FALSE;
    $form['#validate'][] = 'mailchimp_lists_form_field_ui_field_edit_form_validate';
  }
}

Disables the field on the field edit form. I could see the ability to allow "permissions" to take control of the list or something to that effect.

ruscoe’s picture

Assigned: ruscoe » Unassigned
allisondev’s picture

Hi! I removed 3 lines from mailchimp_lists/includes/mailchimp_lists.field.inc that was disabling the Mailchimp List field under subscription field's Global Settings. Once I removed these lines, the field is no longer greyed out. On my site, I was able to select the Mailchimp List I want, and then the list fields were synced with my site's fields. I'm using version 7.x-3.6 of the Mailchimp module.

I'm not sure whether there are some reasons for these lines to disable the field. Perhaps they were used for the earlier 2.x version, but no longer applicable for the 3.x version?

This might not be the best way to solve the issue, but I hope it helps in figuring out the final solution. Thanks!

ruscoe’s picture

Status: Active » Closed (won't fix)

We're going to be ending support for the 7.x-3.x branch due to the upcoming deprecation of the v2.0 MailChimp API. If you're still seeing this issue with the most recent release, please feel free to reopen for the 7.x-4.x branch.

NateRecess’s picture

Same issue for 7.x-4.x. Fix from #11 works.