# Drupal and how to disable notifications for programmatic node updates

Feb 5, 2013 ~ 1 min read

Drupal and how to disable notifications for programmatic node updates
=====================================================================

*   [drupal](https://lirantal.com/tag/drupal)

share this story on

[](https://twitter.com/share?url=https://lirantal.com/blog/2013-02-05/&text=%22Drupal%20and%20how%20to%20disable%20notifications%20for%20programmatic%20node%20updates%22&via=liran_tal)[](https://www.facebook.com/sharer.php?u=https://lirantal.com/blog/2013-02-05/)[](https://www.linkedin.com/shareArticle?url=https://lirantal.com/blog/2013-02-05/&title=Drupal%20and%20how%20to%20disable%20notifications%20for%20programmatic%20node%20updates)[](https://wa.me/?text=Drupal%20and%20how%20to%20disable%20notifications%20for%20programmatic%20node%20updates%20https://lirantal.com/blog/2013-02-05/)

![Programatically working updates on Drupal nodes with node_save() hook](https://cdn.hashnode.com/res/hashnode/image/upload/v1692641260115/f974f663-1bea-4f6b-a1f4-8be1403a7342.jpeg)

More than often, we [Drupal](http://enginx.com/blog/disabling-notifications-programmatic-node-updates/drupal.org) developers find ourselves doing programmatic node modifications via the

    node_save()

function. If you’re doing that as well as have [messaging](http://drupal.org/project/messaging) and [notifications](http://drupal.org/project/notifications) modules enabled in your site then given the case that your users have subscribed to content-type updates and you’re doing these ‘behind the scenes’

    node_save()

stuff then you’re effectively spamming them with email updates each time you run that function.

To mitigate this issue, when saving a node programmatically you can set an attribute for the notifications module to understand that it needs not to send updates for this operation. It’s a quick and easy one:

    function probably_your_hook(&$node) {
     // ... code ... 
     
     // Disable announcements for this operation
     $node->notifications_content_disable = 1;
     node_save($node);
     
     // ... code ... 
    }
