Signup/signout & 'check if signed' up are available as Rule actions/condition #1593224: provide rules integration for 7.x-2.x
But we can't move users to a certain group yet based on a Rule Action.

This would enable us to put users in groups based on everything that we can reach with Rules like product purchases, Role, Profile, Userpoints, Link clicked, page visited, age, site activity, etc.

This piece of code seems to contain code on how to move a member to a different group through the Mailchimp Module (API):
and may be partly reusable

#11 mailchimp73-group-1808704-11.patch8.98 KBMegaChriz
PASSED: [[SimpleTest]]: [MySQL] 64 pass(es).
[ View ]
#6 mailchimp-group-1808704-6.patch3.99 KBklausi
Test request sent.
[ View ]
#1 mc_subscribe_group_rules.patch3.26 KBhibersh


hibersh’s picture

Status:Active» Needs review
new3.26 KB

Rule action "Subscribe user to a mailchimp group" added

It will be great that have groups property for list entity

s1l’s picture

Title:Ability to put a Member into a Group with a Rule Action» Ability to put a Member into a MailChimp Group with a Rule Action

clarifying title to make sure people don't think it's about Organic Groups

s1l’s picture

Issue summary:View changes

updated with link to code that contains clues on how to do this

jsibley’s picture

Issue summary:View changes

It has been more than a year since this patch was offered.

Could it please be committed if it works?

This would make mailchimp significantly more useful within Drupal, since mailchimp autres in favor of having one one list and using groups for segmentation.

jsibley’s picture

It looks like the patch needs to be redone to work with the current dev or recommended versions, as it was never committed and development continued.

Since it looks like the current dev is not recommended for production, if I produce a working patch for the current recommended version, would it be committed? This would be my first patch, but I'm willing to try. It looks like just the line numbers need to be adjusted.

rvb’s picture

Thanks jsibley for doing this. This would be a great feature to have!

klausi’s picture

new3.99 KB
Test request sent.
[ View ]

Updated the patch a bit: use an email address instead of a user object, so that you also can subscribe raw emails without users. Changed the option list to use the machine name instead of the numeric list ID.

Currently the action replaces whatever groupings are specified, the Mailchimp API leaves other groupings that are not mentioned in the request as is anyway.’s picture

ok, I'm trying to get this working (D7, 7.x-3.1).
What should I select as "actions"?
I tried:
entity data selector: account
Mailchimp List Subscription Field entity selector: ??
Add subscription: yes

adam_b’s picture

Has anyone got farther with this? I'd love to be able to specify groups - but so far I can't even get the patch to apply successfully.

adam_b’s picture

Got klausi's patch applied to v2.12, thanks to a friend.

But although I can see the new action "Subscribe email to a mailchimp group", when I select and try to save it I get an error:
Unknown action mailchimp_lists_user_subscribe_intgroup.

MrPeanut’s picture

new3.26 KB

I have applied @klausi's patch from #6. I do see the Group in the Group ID fieldset. However, I'm not really sure what the Groups fieldset is for. It says "The group values separated by commas."


I've entered the group's numerical ID and also the sub-group's numerical ID. Neither one seems to work. I've tried users who are already subscribed and users who are not yet subscribed.

In any case, I'd like to be able to subscribe a user into one of that group's groups. (For example, my "Main Group" has Washington St Location, Riverview Ave Location, etc.)

Lastly, it might be worth moving this development to the 3.x branch.

MegaChriz’s picture

Version:7.x-2.x-dev» 7.x-3.x-dev
new8.98 KB
PASSED: [[SimpleTest]]: [MySQL] 64 pass(es).
[ View ]

Here is a patch for the 7.x-3.x version. The implementation is a bit different from the patch from #6, which was for the 7.x-2.x version. This patch provides two Rules actions:

  • Subscribe email to a mailchimp group
    This action subscribes a mail address to one or more (sub)groups from a single interest group. It doesn't unsubscribe the mail address from other (sub)groups from the same interest group.
    If the mail address is not yet subscribed or unsubscribed it will be (re)subscribed with a single opt-in (no confirmation mail).
  • Unsubscribe email from a mailchimp group
    This action unsubscribes a mail address from one or more (sub)groups from a single interest group. In case the mail address is currently not subscribed, the action will do nothing.

About configuring the actions

Both actions will ask you first for the mail address and the interest group ID. After that a list of available groups within that interest group is loaded (eventually via AJAX).
The code for this is taken from rules_action_type_form_alter() in rules/modules/

Tested with checkboxes only

In only tested this with interest groups where multiple options are allowed (thus with interest groups that are set in MailChimp as checkboxes), not with single option interest groups (radio buttons).