Is there a plan to integrate Organic groups to Mailchimp Lists?
Here is a custom module that we wrote to allow us to integrate with organic groups (OG 7.x-2.x).
This module adds an Organic Groups group field called "Group MailChimp interest group". In the field settings this field can be configured to use a particular Mailchimp list.
Each group can then be associated with an interest group within the Mailchimp list.
When a user is added to the group, their email will be subscribed to the associated interest group within the Mailchimp list. When a user is removed from a group, their email will be unsubscribed from the associated interest group.
This module does not use Mailchimp Lists.
NOTE: This module is currently NOT using Double optin. Stuff like this could easily be set using variables, for our client they did not want to use double optin and I'm just supplying the module as we have it.
I would be willing to answer questions related to this module, and perhaps do some work to make a patch to add it to Mailchimp, or perhaps release it as a standalone module, if others can help define a more generic use case and configuration settings.
@dtarc I would be strongly supportive of this being further developed. Mailchimp has very little integration of interest groups at present, and given they're a fairly basic part of how Mailchimp works this isn't great. Matching them to organic groups should give enough freedom to figure out a wider integration. In the meantime I'll give your module a bash and see how it works. I'm assuming I can still keep using the Mailchimp Lists module alongside it for initial sign-up? Also, does it transfer interest group entry or leaving back in the other direction from Mailchimp to OG? *crosses fingers*
This module depends on MailChimp but not on Mailchimp Lists and does not offer any integration with Mailchimp Lists. The reason for this was that our client wanted everything to happen invisibly--they are using Drupal Commerce to charge people for adding them to og groups, and part of the membership benefits are receiving the newsletter mailouts from Mailchimp. So 1) they didn't want users to be able to join Mailchimp lists/interest groups for free, which using Mailchimp Lists would've allowed (I think) and 2) they didn't want the usability gap of users having an option to leave the interest group and then not receive newsletters (and subsequently complain).
The way this module works is that Drupal pushes to Mailchimp. When a user becomes a member of an og group, they are added to the MC interest group. When they cease to be a member of the og group, they are removed from the MC interest group. Anything that happens on MailChimp has no effect on Drupal.
I'm not sure how much this will ever get built out. Currently what we have here is suitable for who we built it for. Feel free to use the code and start a project namespace on drupal.org. If you're a project manager type and you would direct further development of this module & add some documentation then perhaps I'd be willing to create the project and add you as a co maintainer, and consult in the issue queue about how to do stuff. Beyond that my availability to push this forward is limited (I'd rather put in time pushing og forward frankly).
Integrating MailChimp List Groups with Drupal Organic Groups can be done in several ways.
The most flexible solution may be to have it done through Rules and have the ability to put a Drupal user that is a MailChimp List member into a MailChimp List Group with a Rule Action. This way one could basically put people into a MailChimp List Group when a user views a node or completes a questionnaire - and be able to email that select group of people. (and putting them into a Drupal Organic Group is optional instead of mandatory)
We're sponsoring creation of that Rule Action as we speak, and I hope we can release it this week.
Related issue:#1808704: Ability to put a Member into a MailChimp Group with a Rule Action
In our case we want to put a user into an Organic Group upon Commerce product purchase and put him into a Mailchimp List Group too.
To sync the two one could create a Rule that goes through users of an Organic Group, check if they are subscribed to the MailChimp List and put them in the MailChimp List Group.
s1l, sounds like an interesting approach using rules. How will you match the organic group up with the particular interest group?
@dtarc - That would depend on the requirements of the usecase.
In our case we don't require the lists to be sync-checked, but we do add them to a MailChimp List Group AND Drupal Organic Group at the point of purchase. As some point in the future we probably want a sync-check too to make sure the Mailchimp API actions went through.
Rules could be a very flexible sync approach.
A shot at some use cases (rough versions)
Rules scheduler comes to mind, and/or a single Rule action + Rule components.
Or one could decide not to do it through Rules of course, and make custom code to do the sync.
Rules way - In case you want to sync the Mailchimp List Groups to Drupal Organic Groups
I would go over the user list, create a Rules action like 'get MailChimp List Groups', and go over that interest Group list to add the user to the matching Organic Groups if not yet in the Organic Groups.
Rules way - In case you want to sync Organic Groups to Mailchimp List Groups
Go over the list of Organic Groups -> for every Organic Group go over the list of users of a particular Organic Group, make a Rule condition that can check if the user is in the corresponding Mailchimp List Group, add the user to the Mailchimp List Group if not yet in that List Group (with the action from #1808704)
Related issue sending groups of people an email (aka 'send all purchasers of product 1 this email 1 week after purchase') :#1827034: ecommerce360 integration with Drupal Commerce
There may actually be another way to sync the data (untested, just an idea) :
Use merge fields to sync Drupal Organic Group or user profile (or Profile 2) data with Mailchimp fields/Groups.
The module in #1 zaps node creation for a group it's attached to, if the field is set to a newsletter list at the time of node creation. Setting the field value to a group later on seems to work fine. Error message:
EntityMetadataWrapperException: Unknown data property field_address. in EntityStructureWrapper->getPropertyInfo() (line 339 of [**site root location**]/modules/entity/includes/entity.wrapper.inc)
I'm going to give the module a bash anyway, as it seems like the only way to properly bridge interest groups between Drupal and MailChimp right now.
Whoa. Just tried to join one of the organic groups as a dummy user. Error message:
EntityMetadataWrapperException: Unknown data property field_address. in EntityStructureWrapper->getPropertyInfo() (line 339 of [**the website root**]/modules/entity/includes/entity.wrapper.inc).
This happens if Group MailChimp interest group is set to an interest group. If it is changed to the please select option then organic group joining works normally for the dummy user.
Would appreciate advice on what may be happening here. As it is, the module doesn't work for me and I'll have to uninstall it and do without. D:
Hi, I think field_address was a field on the user, our client wanted the user's address to be pushed to mailchimp. I should have taken those lines out before posting the code. I can't really take the time today to repost but can work with you a bit to resolve the issue.
Hi dtarc, presumably this means that I could resolve by creating a hidden field with machine name field_address, and a merge field or similar in mailchimp called address. Will give it another bash over the next couple of days, but if you could post either a patch or edit of the module without the lines in question that would make life less messy. :)
Minor update - creating a field_address field has indeed stopped errors in creation and editing of organic groups. Haven't checked out what happens with assigning people to them yet - will give that a look in a bit.
Urgh. I spoke too soon. Error on trying to set Group MailChimp interest group at time of group creation:
Fatal error: Call to a member function value() on a non-object in [**Site root location**]/modules/mailchimp_og/mailchimp_og.module on line 235
Editing the node and setting interest group after initial creation works just fine. I'll try not to post more updates until I've finished the process of checking. Ahem.
og_register doesn't play nicely with mailchimp_og by the looks of it, which is a shame but not unsurprising. I'm guessing that the mailchimp_og stuff is getting called before the registration process has finished creating the user record. Error message is:Fatal error: Call to a member function value() on a non-object in [**Root folder location**]/modules/mailchimp_og/mailchimp_og.module on line 235
Fatal error: Call to a member function value() on a non-object in [**Root folder location**]/modules/mailchimp_og/mailchimp_og.module on line 235
User registration without choosing any groups works fine. I'm trying to figure out a way of setting up a process that brings users through group membership selection after they complete the initial registration form, likely using a redirect either after initial submission or after account activation using the one-time login link. Hum.
Drupal is a registered trademark of Dries Buytaert.