I am happy to see that this module now supports limited Rules integration, however the subscription action Subscribe user to a mailchimp list cannot be used for interacting with anonymous visitors. The action will only accept a numeric UserID so it cannot use an email address, for example, that was submitted by an anonymous user through a Webform or as part of a product purchase in an e-commerce setting. See the power of this?

I actually wrote a patch for this and realized that someone else had written a nearly identical patch in #1593224: provide rules integration for 7.x-2.x so I'm re-uploading that user's patch since they did it first.

Anyway, I've tested the patch and it works great.

Comments

This has to be a joke. At the exact same time you were doing this, I was [uh.. re-]writing the same patch! Except mine allows for an array of Mergevars to be manually included and hence I think is better. :-D

But it's practically identical!

Though, I don't think the $EMAIL mergevar is a requirement, per your patch.

That's really too funny. I was actually going to suggest including $mergevars but I figured it would over-complicate things and didn't see a way it could be implemented yet. The $EMAIL mergevar in the patch I uploaded only appears to be necessary if there are no other fields for the merge, otherwise i don't know; perhaps the function would accept $mergevars as an empty array? I didn't try that.

Anyway, I tested your patch and it works just fine for basic subscription, however I cannot test the Mailchimp Merge Variables since I can't find a way to supply the rule with mailchimp_mergevars type data. Can you elaborate on your use case and how you're writing the data selection string?

P.S. I feel like line 77 of the patched file could be written as 'merge_variables' => array( instead of 'mergevars' => array( for consistency with the associated function.

I can confirm that the $EMAIL mergevar in the patch I posted is necessary for Mailchimp to successfully report to the watchdog at admin/reports/dblog. Otherwise there is no indication of who was subscribed to the list. Your patch does not report properly since it does not include this.

Status:Needs review» Reviewed & tested by the community

Since there has been no response regarding the more complex patch in comment #1, I'm changing the issue status for the purpose of committing the ORIGINAL PATCH. Again this patch was not created by me; it came from #1593224: provide rules integration for 7.x-2.x and since I've verified that it works, I think it should be committed.

@Offlein: Perhaps you can create a separate issue to further the work on your more complex patch to support merge variables.

Status:Reviewed & tested by the community» Patch (to be ported)

hopefully a change of status will prompt the attention of an admin to commit this

related issue #1808704: Ability to put a Member into a MailChimp Group with a Rule Action
It allows you to put a subscriber in a MailChimp Group with a Rules action.
I think it currently subscribes the user to the list if the user not yet on the list that the group belongs to.

Status:Patch (to be ported)» Reviewed & tested by the community

The suggested patch looks fine.

Currently I'm using a form created with Entityforms module. It would be nice to get values from the fields on the form and use as merge variables. What do you think?

Issue summary:View changes

I am in the same boat as #8. The patch works great gathering the email address, but it would be great to pull values such as name, etc from the entity form into merge fields.

I agree that merge fields would be great, but can this at least be committed as a starting point so it becomes part of the module code base? Merge fields would be the next step. Once this is committed we can then work off of the dev version to add merge fields.