Comment Notify
Sends notification emails to visitors about new published comments on pages where they have previously commented.
comment_notify
Install
composer require 'drupal/comment_notify:8.x-1.5'
composer require 'drupal/comment_notify:8.x-1.4'
Overview
Comment Notify is a lightweight tool to send notification emails to visitors about new, published comments on pages where they have commented. It works for both registered and anonymous users.
Providing comment notifications for anonymous users is an important tool in bringing anonymous users back to your site, which helps convert anonymous users to registered users. Anonymous comment notification is a critical tool in building a blog comment community; all the major blogging platforms include this functionality.
The module supports two subscription modes: users can subscribe to all comments on an entity or only to replies to their specific comment. Entity authors can also receive notifications when new comments are posted on their content.
Features
- Email notifications for both anonymous and registered users when new comments are posted
- Two subscription modes: 'All comments' on the entity or 'Replies to my comment' only
- Entity author notifications: content authors can receive emails about all comments on their content
- Per-user notification preferences stored in user profiles
- Customizable email templates with Token support for dynamic content
- One-click unsubscribe links in notification emails
- Admin interface to bulk unsubscribe users by email address
- Support for multiple entity types (nodes, taxonomy terms) with comment fields
- Configurable default notification settings for new users
- Automatic notification checkbox on comment forms
- Secure hash-based unsubscribe mechanism for anonymous users
Use Cases
Blog Comment Community Building
Enable comment notifications for blog content types to keep readers engaged. When someone comments on a blog post, they can opt to receive notifications about replies. This encourages ongoing discussions and brings readers back to the site, converting anonymous visitors to registered community members.
Support Forum Notifications
Configure Comment Notify for forum or support ticket content types. Users asking questions can subscribe to 'Replies to my comment' to be notified when they receive an answer, while support staff can subscribe to 'All comments' to monitor entire discussions.
Content Author Engagement
Enable entity author notifications so content creators automatically receive emails when their articles, products, or other content receives comments. Authors can manage this preference in their user profile settings.
Anonymous User Conversion
Allow anonymous users to subscribe to comment notifications by enabling the 'Subscribe to comments' permission for anonymous users and configuring comment fields to collect email addresses. The notification emails include links encouraging users to create accounts for additional features.
Tips
- Use the Queue Mail module on high-traffic sites to improve performance by deferring notification emails to background processing
- Customize email templates with Token module tokens to create personalized, branded notification emails
- The notification checkbox can be hidden via CSS if you want to force a default setting (see Drupal.org issue #322482)
- User notification preferences are stored per-user, allowing each person to customize their experience
- The module weight is set to 10 during installation, ensuring other modules can process comments before notifications are sent
- Unsubscribe links use secure hashes, so they work reliably even for anonymous users
- Test your email templates thoroughly, especially token replacements, before deploying to production
Technical Details
Admin Pages 2
/admin/config/people/comment_notify
Configure global settings for comment notifications including which content types to enable, subscription modes, default settings, and email templates.
/admin/config/people/comment_notify/unsubscribe
Administrator tool to bulk unsubscribe a user by their email address. All comment notification subscriptions associated with the email will be disabled.
Permissions 2
Hooks 1
hook_comment_notify_options_alter
Allows modules to alter the available notification options displayed to users
Troubleshooting 5
Ensure three things: 1) Anonymous role has 'Subscribe to comments' permission, 2) Anonymous role has 'Post comments' permission, 3) The comment field is configured to allow or require anonymous users to leave their contact information (edit the comment field settings).
Check that the content type/bundle is enabled in Comment notification settings, verify that the commenter checked the notification checkbox, ensure your site's email system is properly configured (test with other modules), and check the Drupal logs for mail-related errors.
The warning indicates a configuration mismatch. Either grant anonymous users the 'Post comments' permission, or configure the comment field to allow contact information, or remove the 'Subscribe to comments' permission from anonymous users if notifications aren't needed for them.
This is by design prevented - users should not receive notifications for comments they post themselves. If this is happening, ensure the email addresses match between the comment and user account.
Check that 'Subscribe users to their entity follow-up notification emails by default' is enabled in settings, or have the author enable this option in their user profile under 'Comment follow-up notification settings'.
Security Notes 4
- Unsubscribe links use CSRF-protected hashes to prevent unauthorized unsubscription
- Email notifications only reveal comment content that users have permission to view
- The admin unsubscribe feature requires the 'administer comment notify' permission
- This module is covered by Drupal's Security Advisory policy