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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Offlein’s picture

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.

nodecode’s picture

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.

nodecode’s picture

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.

nodecode’s picture

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.

nodecode’s picture

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

silkogelman’s picture

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.

nodecode’s picture

Status: Patch (to be ported) » Reviewed & tested by the community
FiNeX’s picture

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?

xbrianx’s picture

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.

nodecode’s picture

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.

amytswan’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

“And now our watch [for support of the 7.x-2.x version of the MailChimp module] has ended…” With the approaching deprecation of MailChimp’s API version 2.0, I’m sad to say we too must turn the page. This branch will become unsupported in early October and officially deprecated by the end of this year (2016).

Fret not! The 7.x-4.x and 8.x versions come highly recommended. Both are using Mailchimp’s new API 3.0 and are being actively maintained. If you find this issue still exists on either the 7.x-4.x or 8.x branches, let us know by opening a new ticket. “What is dead may never die, but rises again, harder and stronger!”

Greg Boggs’s picture

Version: 7.x-2.x-dev » 7.x-4.x-dev
Status: Closed (won't fix) » Needs work

This patch likely needs a reroll against 4.x

samuel.mortenson’s picture

Status: Needs work » Closed (won't fix)

We’re in maintenance-mode for the Drupal 7 releases of Mailchimp, so only bug fixes can be committed going forward. Any new features should be developed for the Drupal 8 releases of Mailchimp. Thanks!