Limit Autosubscribe to Enabled Nodes

Messaging and Notifications are popular Drupal modules that can be used for a website forum to notify original poster of replies, or an administrator of comments posted for a specific content type. When 'Set all users to "autosubscribe" by default' is enabled in admin/messaging/notifications/content, it generates notification subscriptions even for node types that are not enabled. In other words, all nodes created by a user automatically get a new subscription. This may be troublesome, especially when creating new content on the site - at the very least creating numerous useless subscriptions. Drupal community provides a patch that checks for allowed content types. As an alternative, these 5 lines of code perform the check. Add them on line 54. and the 'try' this test.

if ($type == 'thread') { $node = node_load($value); if(!array_key_exists($node->type, notifications_content_types())) { return; } }

Simple and efficient solution!

Share this post