Hi Guys

We just found what we think is a bug (although I opened this as a feature request) in how the module subscribes to mailing lists when new accounts are created.
When an anonymous user creates a new account on a site and selects one or more of the mailchimp lists to subscribe to, it gets automatically subscribed to them, even when the settings in Drupal for new accounts are set to "requires admin approval".

We think that following Drupal behaviour, the module should only add the user to the mailchimp lists once the account has been approved.

Cheers

Comments

Version:6.x-2.x-dev» 7.x-2.x-dev
Component:General» Lists

This is still the case in 7.x-2.x!

I think having the ability to defer actual subscription would be a pretty powerful feature. I can see jm.federico's use case for doing subscription on user account approval. I have a slightly different use case: I'm using LoginTobbogan to require users to verify their e-mail before getting full access to the site. It would be great to defer list subscription until they actually verify their e-mail, removing the need for Mailchimp's double optin (since Drupal is handling that).

Looking at the code, everything is handled directly in hook_user_insert(). I'm not sure what the right approach is yet, but it'd be cool if there was some way to hook in and setup some custom code to defer the subscription until later. I need to think about it some more before writing a patch.

Comments or advice would be appreciated!

I have an idea about how I could implement this, even in a seperate module (maybe "mailchimp_deferred_subscribe"?):

  1. Using hook_user_presave() we could grab $edit['mailchimp_lists'] and stash it in $edit['data'], so that mailchimp_lists_user_insert() wouldn't subscribe the user right away and we'd have the data for later.
  2. Then we'd register a new action with the Rules module for completing a deferred subscribe for a user, which would pull the info out of $account->data, actually perform the subscribe and clear out the info in $account->data.

jm.federico would be able to create a Rule that triggered on the event "After saving a new user account" that would cause the deferred subscribe action to happen when the user goes from "Blocked" to "Active" (which is what happens when an adminstrator approves an account).

This would also suit my use case, because LoginToboggan registers a Rules event that occurs when the user has verified their e-mail address.

The one thing I'm worried about is that jm.federico's use case seems pretty basic. I have the nagging feeling that it should probably be supported directly in mailchimp_lists. Requiring another module and Rules seems excessive. On the other hand, for my use case, it seems totally reasonable because it's a more complex/advanced thing to do.

I'd appreciate advice from the mailchimp module maintainers if you have time!

Status:Active» Postponed (maintainer needs more info)

In the D7 version, mailchimp_lists_user_sync() already checks for account status before subscribing a user, so not sure there's an issue?