2

This was quite straightforward in Drupal 7 as I recall but, with Drupal 8 there's a lot of info I don't understand as a site builder that I am being asked to provide when creating a new rule.

I'd be very grateful for some step by step help.

I want to send an email to all users with the role of "Officer" when a node of type "Agenda" has been updated.

Right now (Feb 10 2018) I have:

"drupal/core": "8.4.4"
"drupal/mailsystem": "4.1"
"drupal/swiftmailer": "1.x-dev"
"drupal/rules": "3.x-dev"  
"drupal/typed_data": "1.x-dev"

2 Answers 2

0

I'm a bit familiar with the (amazing!) Rules module. But to my knowledge the current answer to this question is a No go, that is: can't do that yet with the most recent D8 version of Rules.

Refer to #d8rules status update November 2017 to get a better understanding of the current status of Rules for D8. Here are some quotes from it:

  • ... Fago can’t dedicate time required to develop the module further. What Rules is really missing at the moment is development capacity to help finish the last milestone.

  • ... Even if we got more funding today, fago the current principal maintainer of the Rules module wouldn’t have enough capacity to do the work himself.

One never realizes what has been done, only what remains to be done ... So start here if you wonder how to contribute.

BTW, Rules documentation for D8 contains the official Rules documentation specific for D8.

Plan B

While waiting for Rules to become more mature, you can use the Admin Content Notification module as a temporary alternative (which does have an official D8 release already). Some details about it (from its project page):

... can be used for receive email notification when a new content of any content type will be created on your site. Although one can use rules for the same functionality but it's not good to use rules only for notification as it is a huge module, so we can use this module for small websites.

The "...Although one can use rules for the same functionality ..." part of this clearly does not apply to the D8 version of Rules (yet).

The image shown on the project page gives an idea of what this module can be used for.

Obviously, your question is about updates of content. But even though it doesn't say so (yet) on the project page, just have a look at the issue "Also trigger event on update", which appears to be as in your question.

5
  • Thanks @Pierre.Vriens for the heads up. The latest dev version (of a few days ago) seems to have many / most of the pieces in place for sending an individual email (rather than to a set of users of a Role) upon content change. Maybe I'll frame a separate question about how the latest beta can be used to effect this simpler task. In the meantime I'll follow your recommendation and try Admin Content Notification.
    – iainH
    Feb 10, 2018 at 14:04
  • @iainH merci for the previous comment. "latest dev version*? Right now the project page says "updated 18 Jan 2018 at 16:03 UTC" (that's not a few days ago IMO). Also: where did you find that beta (anything more recent then alfa3 )? Anyway, I'm curious to hear your additional feedback after you tried the alternative (for now) I suggested ... Feb 10, 2018 at 14:14
  • Thanks @Pierre.Vriens for the pointer. Admin Content Notification will do the job quite nicely for now. Easy to use. It does not seem too difficult for me to adapt it to be a bit more suited to my needs: 1) A different email per content type e.g. Agenda changes to Officers; Meeting changes to Councillors. 2) Lists of usernames instead of one hard-coded email address.
    – iainH
    Feb 10, 2018 at 15:41
  • Can confirm Admin Content Notification will optionally notify on content updates as well as creation, although not on deletion.
    – iainH
    Feb 10, 2018 at 15:44
  • @iainH hm, merci for the feedback about my, for now, suggested work-around (and "accept"). About that deletion: hey, can't have everything, right? Possibly (haven't looked at it yet) a variation of the patch in the issue I mentioned might make that work also? Feb 10, 2018 at 15:48
0

There are only two Rules actions that haven't been fully ported to D8 yet, and "Send mail to all users of a role" is one of them. When it is finally ported, it should provide the same capability as in D7.

There's a patch in the Rules issue queue which ports this action to D8 - you can try out that patch to see if it solves the issue for you. See: Port Send mail to all users of a role (mail_to_users_of_role) action to D8

If this action is important to you, please help out in the Rules issue queue by testing the proposed patch, supplying feedback, and helping out with the parts that are still missing from that patch.

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