1

On a Drupal 8 site I'm working on, we are using Simplenews to allow users to subscribe to a mailing list for blog posts. The client would like us to set up a rule to automatically send an email to everyone on this specific blog post subscriber list whenever a new blog post is published.

I have gotten to the point where Rules will send out an email to a specific email every time a new node of type Blog Post is published, but I can't figure out how to reference a specific list of Simplenews subscribers through Rules' data selector. Does anyone know how to create that? Or maybe a work around for this?

0

Assuming your question is about D7, and looking at the available integration of Simplenews with Rules, there is no out-of-the-box solution (at least not that I'm aware of). So as per your "... maybe a workaround for this?", below is a blueprint of how to get it to work anyhow ...

  • Create a custom rule in which you use Rules Event "A user has been subscribed", with a Rules Action to flag such user, using the Flag module, and by using a global flag. Label the flag something like "Subscribe to Blog posts Newsletter".
  • Create a similar custom rule in which you use Rules Event "A user has been unsubscribed", with a Rules Action to unflag such user (for the same flag as described above).
  • Use the Views module to create a list of all users flagged by the flag described above.
  • Use the Views Rules module to create an additional Views display in the view described above, of type "Rules".
  • Improve your existing rule by adding a Rules Action to load the list of all users included in the Rules display created as described above. That should be the list you're asking about in your "specific list of Simplenews subscribers".

True, 3 extra modules (Flag, Views and Views Rules) needed to get this to work. But zero custom code required ... (together with 2 extra rules, and a refinement of your existing rule).

  • So I'm actually working with a Drupal 8 site (just updated the question). Would this work with that as well? – ConorBaumgart Dec 6 '17 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.