I found that I had users being subscribed to lists after registration, even if they had indicated that they did not want to subscribe. After some debugging, I noticed that users that indicate subscription are immediately subscribed while users that do not are added later. This led me to investigate cron and I found this:

In the mailchimp_lists.module, there is a function mailchimp_lists_user_sync() which is called from the very last line of mailchimp_lists_user_insert() and from mailchimp_lists_user_update(). This function iterates over the available lists and if $lists->settings['cron'] evaluates to TRUE, it will add the user to the list even if $list->subscribe is FALSE.

From mailchimp_lists.module, starting around line 358:

358   // Add subscriptions if necessary
359   $lists = mailchimp_lists_get_available_lists($account, array(MAILCHIMP_LISTTYPE_REQUIRED, MAILCHIMP_LISTTYPE_OPTIONAL));
360   if (!empty($lists)) {
361     $mcapi = mailchimp_get_api_object();
362     foreach ($lists as $list) {
363       if ($account->status) {
364         // queue up for cron processing
365         if ($list->settings['cron']) {
366           $queue = DrupalQueue::get(MAILCHIMP_QUEUE_CRON);
367           $queue->createQueue();
368           $queue->createItem(array(
369             'uid' => $account->uid,
370             'list_id' => $list->id,
371             'op' => 'add',
372           ));
373         }
374         // process immediately
375         else {

Shouldn't line 365 be:

365         if ($list->settings['cron'] && $list->subscribe) {

Comments

gcb’s picture

Status: Active » Fixed

This is fixed in the dev tree, commit message got the wrong issue ID. db33489.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

add line numbers