CCK edits do not trigger an 'node update' subscription

Bimble - May 3, 2009 - 19:14
Project:Subscriptions
Version:5.x-1.6
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

First of all, thanks for the great module - I seem to have just one problem with it.

I want subscribers to get emails on node 'updates', this currently works fine when the edited field is the 'body' field. However, when just CCK fields of the same node are edited nothing is going into the subscription_queue.

Do you know if this this a bug, or a known limitation?

I should add (just in case) that i'm editing the CCK fields through a php script ending with a node_save($node)

#1

Bimble - May 3, 2009 - 19:42

Further testing reveals that it's not do with only CCK but with the fact that any node field edited via my php/node_save seems not to trigger the subscription update?

Any ideas why this should be so?

#2

salvis - May 3, 2009 - 20:45
Category:bug report» support request
Priority:critical» normal

No, I don't see why this wouldn't work. node_save() calls node_invoke_nodeapi($node, 'update'), which calls subscriptions_content_nodeapi(&$node, 'update'), which calls subscriptions_queue($event), which queues the notifications.

Follow this trail to find out where the problem is...

#3

salvis - May 30, 2009 - 22:43
Status:active» closed

#4

Bimble - August 28, 2009 - 12:18

Fix:

I found that when the node is created, in subscriptions_content_nodeapi(&$node, 'update') then all switch($op) all cases (prepare, update, and insert) are being executed. When 'prepare' is executed, the line $node->subscriptions_notify = TRUE is being called.

However, when a node is being updated, the 'prepae' case is not executed. So $node->subscritions_notify is never run.

So:

if ($node->subscriptions_notify) {
subscriptions_queue($event);
}

..always returns false, so the queue is never called

My fix, was to paste $node->subscriptions_notify = TRUE; into the case 'update'

#5

salvis - August 28, 2009 - 22:03
Status:closed» active

Thank you for pursuing this.

Your 'fix' makes it impossible to suppress notifications when you update a node.

I think a better solution would be to treat case 'load' just like case 'prepare'. Please try that.

 
 

Drupal is a registered trademark of Dries Buytaert.