This project has been moved to https://www.drupal.org/project/message_integration.
Custom code for Message stack and Swiftmailer to create messages about new/changed nodes and comments and email them to subscribers.
The following modules are used:
The logic used for subscribing users to content and sending them emails
includes the following. See message_integration.module and the message
templates for more details.
- All active users will automatically be sent all new content.
- When a node is first published, the code will render the
messageview mode of the node in an HTML email and send it to the subscriber list. - When a new revision is created in a published node, the code will use Diff module to just display what changed and send the diff in an HTML email to the subscriber list.
- When new comments are added, the code will notify the users subscribed to the
node. The email will display the
compactview mode of the content and thedefaultview mode of the new comment an HTML email.
This code is too opinionated to use as a normal contributed module. But you you can fork it, adjust it to your own needs, and use it elsewhere.
To use this on your own site, fork this code, then add the requirements and patches in composer.json to your primary composer.json.
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"forked-repo/message_integration": {
"type": "vcs",
"url": "https://github.com/forked-repo/message_integration.git",
"no-api": true
}
},
- Make sure all the required code (with patches) is available by running
composer require forked-repo/message_integration. - Enable this module, which will install all the other required modules:
drush en message_integration - Lots of tweaky little steps can't be done until after everything is
installed. Do them by running
drush message_integration:configureafter enabling the modules. - Enable the
messageview mode to control the display that will be rendered in messages. - Subscribe to some content.
- Create/edit content and add comments to it.
- Run cron to trigger queued messages and emails.
- Navigate to
admin/content/messagesto see the generated messages. - Navigate to
admin/structure/messageto edit and change message templates.
Review the code in message_implementation.module to see what hooks are being
used to generate messages. You can alter them as needed. You'll also want to
edit the list of libraries used to generate HTML email to add your own theme
libraries.