I am using Outline Designer to facilitate books organization.
The problem is that each time a page is moved in the hierarchy, the page weigh attribute of many nodes is changed, firing a blast of notifications.

There is a tick box on the node form to prevent notification but it work only in the case of manual editing.

How notifications could be prevented in this kind of situation?
Thanks for help

Comments

jvieille’s picture

Title: Any way to prevent non-user originated node updates (i.e. book ordering with OD)? » Prevent notifications on backend node updates (i.e. book ordering with OD, VBO, rules)
Category: support » bug
Priority: Normal » Major
Status: Active » Needs review

Found the problem.
I set this as a bug, definitely
Major as this can be devastating : notifications are fired as soon as something happens to a node which does not involve the edit form (think about VBO, rules...

The code was checking an empty notifications_content_disable variable. Empty means "0" as well as nothing.
When a node is updated from the edit form, the variable is set to either 0 or 1
When a node is updated by backend actions, the form is not involved and this variable is not set at all.
Checkg the "0" value insited of empty solved the issue

in notifications_content.module:

function notifications_content_nodeapi(&$node, $op, $arg = 0) {
  global $user;
  // Keep track of nodes so we don't send notifications twice for the same node. See http://drupal.org/node/722432
  static $done;
  
  switch ($op) {
    case 'load':
      // Store current status for later reference
      $node->old_status = $node->status;
      break;
    case 'update':
    case 'insert':
     // Notifications just for published nodes. If we don't have any option enabled for this content type, skip the event
-      if (!isset($done[$node->nid]) && $node->status && empty($node->notifications_content_disable) && notifications_content_type_enabled($node->type)) {
+      if (!isset($done[$node->nid]) && $node->status && ($node->notifications_content_disable === 0) && notifications_content_type_enabled($node->type)) {
        $done[$node->nid] = TRUE;

function notifications_content_comment($comment, $op) {
  // $comment can be an object or an array.
  $comment = (object)$comment;
// JV prevnet notifications from backend
//  if ($op == 'publish' && empty($comment->notifications_content_disable) &&
  if ($op == 'publish' && ($comment->notifications_content_disable === 0) &&
    (!isset($comment->notifications_comment_status) || !empty($comment->notifications_comment_status)) ) {