Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Just wondering if this module provide rules integration to send emails with Mailchimp.
Comments
Comment #1
alexverb CreditAttribution: alexverb commentedGotcha, it didn't have rules integration yet. But it will soon, if you help me review this patch :).
It contains two rules:
Comment #2
ibuildit CreditAttribution: ibuildit commentedWorks fine for me. Would love to see this committed.
Comment #3
andyg5000Thanks @alexverb,
I re-rolled this for the 3.x branch and fixed some coding standards. Patch attached.
Comment #4
andyg5000Template 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.
Comment #5
MrPeanut CreditAttribution: MrPeanut commentedPatch 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.
Comment #6
MrPeanut CreditAttribution: MrPeanut commentedActually, I am getting an error on Rules config pages, although it doesn't seem to affect the functionality of the patch.
Comment #7
mnlund CreditAttribution: mnlund at Ramsalt Lab commentedI 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
Comment #8
ruscoe CreditAttribution: ruscoe at ThinkShout for Mailchimp commentedThank 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.
Comment #9
andyg5000Need this for 4.x
Comment #10
andyg5000Here's a re-roll for 4.x please test! :)
Comment #11
szeidler CreditAttribution: szeidler as a volunteer and at Ramsalt Lab commentedTested #10 on 7.x-4.5 and it seems to work like charm.
Comment #12
szeidler CreditAttribution: szeidler as a volunteer and at Ramsalt Lab commentedComment #13
Perignon CreditAttribution: Perignon commentedTwo thumbs up! I been wanting to work on this for months!
Comment #14
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedThe patch works fine with 4.5 but seems to not work with 4.7
Comment #15
fgjohnson@lojoh.ca CreditAttribution: fgjohnson@lojoh.ca commentedLove to see this in 4.7 as well.
Comment #16
a.ross CreditAttribution: a.ross commentedInteresting. A welcome addition would be a condition to check whether a user is subscribed to a specific campaign.
Comment #17
mcrump CreditAttribution: mcrump commentedRerolled patch against lastest 7.x-4.x branch.
Comment #18
andyg5000If possible, can you provide an interdiff on #10 :)
Comment #19
andyg5000Added
Comment #20
szeidler CreditAttribution: szeidler as a volunteer and at Ramsalt Lab commentedI successfully tested patch in #17 using mailchimp 7.x-4.8.
I didn't used any special segment, just the
Comment #21
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedThe 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
Comment #22
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedUpdating patch #22:
Shouldn't the new file be in the
mailchimp/includes
folder, like the other.inc
s ?Comment #23
andyg5000Rules 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.
Comment #24
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedOn 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 theregistry
table.drush cc all
,drush rr
, evendrush 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.
Comment #25
szeidler CreditAttribution: szeidler as a volunteer and at Ramsalt Lab commentedI 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
Comment #26
andyg5000Ok, 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?
Comment #27
szeidler CreditAttribution: szeidler as a volunteer and at Ramsalt Lab commentedThat sounds like a valid approach for me. It would be great see that nice functionality in the module.
Comment #28
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedProposing new patch, based on 17, 21, 22:
.rules.inc
, which is placed in the module's root folder.MailchimpCampaignTokenEvaluator
class is moved to its ownmailchimp_campaign.eval.inc
file, which is placed in theincludes
folder..info
file gets updated to contain themailchimp_campaign.eval.inc
only.Comment #29
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedComment #30
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedPatch #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.
Comment #31
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedPatch #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).
Comment #32
samuel.mortensonWe’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!
Comment #33
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedAfter 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.