Just wondering if this module provide rules integration to send emails with Mailchimp.

CommentFileSizeAuthor
#31 interdiff-30-31.txt1 KBefpapado
#31 mailchimp_campaign-add-rules-integration-2030755-31.patch20.69 KBefpapado
#30 interdiff-2030755-28-30.diff.txt773 bytesszeidler
#30 mailchimp_campaign-add-rules-integration-2030755-30.patch20.54 KBszeidler
#28 mailchimp_campaign-add-rules-integration-2030755-28.patch20.53 KBefpapado
#22 mailchimp_campaign-add-rules-integration-2030755-22.patch19.6 KBefpapado
#21 add-rules-file-to-info-2030755.patch602 bytesefpapado
#19 interdiff.txt8.36 KBandyg5000
#17 mailchimp_campaign-add-rules-integration-10.patch19.57 KBmcrump
#10 interdiff.txt8.93 KBandyg5000
#10 mailchimp_campaign-add-rules-integration-2030755-9.patch15.42 KBandyg5000
#7 rules_integration_for-2030755-7.patch15.47 KBmnlund
#4 mailchimp_campaign-add-rules-integration-2030755-4.patch15.34 KBandyg5000
#3 mailchimp_campaign-add-rules-integration-2030755-3.patch15.37 KBandyg5000
#1 mailchimp_campaign-add-rules-integration-2030755-1.patch14.97 KBalexverb
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexverb’s picture

Title: Action rule to send emails with Mailchimp? » Rules integration for mailchimp campaign
Category: Support request » Feature request
Issue summary: View changes
Status: Active » Needs review
FileSize
14.97 KB

Gotcha, it didn't have rules integration yet. But it will soon, if you help me review this patch :).

It contains two rules:

  • Create mailchimp campaign (full support for tokens and templates)
  • Send mailchimp campaign (just an action that takes the campaign id as argument)
ibuildit’s picture

Works fine for me. Would love to see this committed.

andyg5000’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
FileSize
15.37 KB

Thanks @alexverb,

I re-rolled this for the 3.x branch and fixed some coding standards. Patch attached.

andyg5000’s picture

Template support in the previous patch was broken. Fixed in this one. It might be nice to wrap the template fields in fieldsets to match UI of the admin interface for campaigns, but I couldn't get this working.

MrPeanut’s picture

Patch from #4 still seems to work. However, it doesn't allow the user to select a List Segment like you are able to on the "regular" Add Campaign form.

MrPeanut’s picture

Actually, I am getting an error on Rules config pages, although it doesn't seem to affect the functionality of the patch.

Notice: Undefined index: text in /mrpeanut/sites/all/modules/rules/modules/data.eval.inc on line 173

mnlund’s picture

I got some errors using the patch from #4. I created a new patch with some changes to campaign creation in mailchimp_campaign_action_create_campaign

ruscoe’s picture

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

Thank you for the patches! Unfortunately we're going to be ending support for the 7.x-3.x branch due to the upcoming deprecation of the v2.0 MailChimp API. If you're still interested in this feature, please feel free to reopen for the 7.x-4.x branch.

andyg5000’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev
Status: Closed (won't fix) » Active

Need this for 4.x

andyg5000’s picture

szeidler’s picture

Tested #10 on 7.x-4.5 and it seems to work like charm.

szeidler’s picture

Status: Active » Needs review
Perignon’s picture

Two thumbs up! I been wanting to work on this for months!

efpapado’s picture

The patch works fine with 4.5 but seems to not work with 4.7

fgjohnson@lojoh.ca’s picture

Love to see this in 4.7 as well.

a.ross’s picture

Interesting. A welcome addition would be a condition to check whether a user is subscribed to a specific campaign.

mcrump’s picture

Rerolled patch against lastest 7.x-4.x branch.

  • Added mailing list segment support.
  • Added support for working with mailchimp-fix_campaign_non_int_id-2630034-3.patch.
andyg5000’s picture

If possible, can you provide an interdiff on #10 :)

andyg5000’s picture

FileSize
8.36 KB

Added

szeidler’s picture

I successfully tested patch in #17 using mailchimp 7.x-4.8.

I didn't used any special segment, just the

efpapado’s picture

The patch works ok, but the new file (modules/mailchimp_campaign/mailchimp_campaign.rules.inc) should be included to the module's .info file, or else the classes cannot be located.

Proposing patch

efpapado’s picture

Updating patch #22:
Shouldn't the new file be in the mailchimp/includes folder, like the other .incs ?

andyg5000’s picture

Rules does it's own auto loading, so the comment in #21 isn't necessary. The rules.inc files should also be in the root of the module (or sub-module) folder in this case. Are there any other changes that you've made in #21 and #22? If not, we should go back to reviewing #17.

efpapado’s picture

On my local setup, I was constantly getting the fatal error:

Fatal error: RulesPlugin::getArgument(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "MailchimpCampaignTokenEvaluator" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /sites/all/modules/contrib/rules/includes/rules.core.inc on line 974

The class MailchimpCampaignTokenEvaluator was missing from the registry table.
drush cc all, drush rr, even drush rr --fire-bazooka did not seem to fix.

When I added the class in the table with a custom query, it worked good, until I tested the drush rr --fire-bazooka and the class disappeared again.

By applying the 2 patches it seems to work. I'm not sure if it's the correct way, but it's the only way I could make it work.

szeidler’s picture

I ran into the same problem like efpapado, in a different project. But as we're working in the same team, we might have a similar setup.

Without adding the file to .info I ran into the issue with the following scenario:

- cache enabled
- apply patch
- drush cc all
- drush rr
- rule is working
- drush cc all
- rule stopped working because of missing MailchimpCampaignTokenEvaluator

andyg5000’s picture

Status: Needs review » Needs work

Ok, sounds like we need to move the MailchimpCampaignTokenEvaluator class to it's own file that's in includes/ and added to the .info file. That's what rules core is doing with the base class. The other rules hooks should stay in the *.rules.inc file which should not be in the .info file array

See http://www.drupalcontrib.org/api/drupal/contributions!rules!rules.api.ph...

Does that sound right?

szeidler’s picture

That sounds like a valid approach for me. It would be great see that nice functionality in the module.

efpapado’s picture

Proposing new patch, based on 17, 21, 22:

  • All the logic stays into the .rules.inc, which is placed in the module's root folder.
  • The MailchimpCampaignTokenEvaluator class is moved to its own mailchimp_campaign.eval.inc file, which is placed in the includes folder.
  • The .info file gets updated to contain the mailchimp_campaign.eval.inc only.
efpapado’s picture

Status: Needs work » Needs review
szeidler’s picture

Patch #28 is working fine for me using Mailchimp 7.x-4.8. Due one of the recent changes in the mailchimp module the template select field is limited to 10 items. Because of the default templates provided by Mailchimp your custom template might be easily skipped in the option list. For that reason I created a reroll of the patch using a higher option list limit in the function call.

efpapado’s picture

Patch #30 was working fine but suddenly I started getting a 500 error on one project. I didn't have much time to debug the reason, proposing a new patch that fixes it (although it might be just a workaround).

samuel.mortenson’s picture

Status: Needs review » 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!

efpapado’s picture

After the maintainer's decision, the patch was converted to a new module: https://www.drupal.org/project/mailchimp_campaign_rules
The initial commit is just a copy-paste, so it's quite possible to be useless until function names are updated properly.