Form save logic is treating optional lists as required lists when queueing user subscriptions. Attached patch will skip the step if roles have been added. Larger fix logic is needed, though, as we could still have this issue if roles are both added and removed simultaneously. mailchimp_lists_queue_existing needs to be more intelligent about adding in addition to using the queue system.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, fix_autosubscribe_logic_on_list_save.patch, failed testing.

The last submitted patch, fix_autosubscribe_logic_on_list_save.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, fix_autosubscribe_logic_on_list_save.patch, failed testing.

BabaYaga64’s picture

Status: Needs work » Closed (cannot reproduce)

I tried to reproduce this issue in 7.x-3.x but I wasn't able to. I also cannot find the mailchimp_lists_queue_existing function in the code. Is this patch out of date, or is there a way that I can help in making it work for the current MC version? Happy to help in any way I can.

gcb’s picture

It's a patch for the 2.x branch: 3.x is a whole different game (this issue has never appeared there).

BabaYaga64’s picture

I tried reproducing this issue, but I was not able to get subscribers automatically added to optional lists, even when I set the batch processing subscription option and ran Cron manually. I also tested saving a new user without running the Cron batch processing option. I am running the MailChimp 7.x-2.x version and the only lists that users are automatically subscribed to are the required lists.

I noticed that after checking the "Sync List During Cron" checkbox while creating a new list, that an option appeared on my list display called "Queue existing". When I clicked this option link, I was taken to a page that asked me if I wanted to queue existing users to the list signup. I went ahead and selected this option, but my users were still not showing up as subscribed to the optional list, both before running Cron manually and after running Cron manually.

Here are screen shots of my lists, and my authenticated user, Fiona, whom I did not add to the optional lists, Waffles and Test List. After selecting the "queue existing" option for these lists, I expected Fiona to be automatically subscribed to both of these as per the issue, but she was not added.

BabaYaga64’s picture

Status: Closed (cannot reproduce) » Closed (fixed)

It appears that this issue has been fixed with the following code, which has been added to the Drupal.org version of the MailChimp 7.x-2.x branch. (I was using an older version of the 7.x-2.x MailChimp branch, which didn't have this code, and thus couldn't reproduce the issue). Thank you to gcb for pointing this out :)

 if ($list->settings['required']) {
        $merge_vars = mailchimp_lists_load_user_mergevars($user, $list);
        mailchimp_lists_execute_change('add', $list, $user->mail, $merge_vars, $user, NULL, $queue);
        $count++;
      }