Hi all,

I try to use hook_nodeapi to do action_x when $ops is update and field_y value = z
but when the condition fulfilled, the action_x get called twice.
Anyone know what could be the problem and the solution?

Comments

winarto’s picture

P.S when i remove action_x from the hook_nodeapi, the action_x is not called at all when the condition is fulfilled, so i'm sure there is no other function that called action_x when condition fulfilled.

winarto’s picture

StatusFileSize
new12.1 KB

Sorry, in case it is not clear...
I attached the screenshot...
In this screenshot, i call drupal_set_message('You just updated a node.') when $ops is update (without any additional condition)
so, when i update, the message appear twice...

glass.dimly’s picture

Version: 6.14 » 6.19
StatusFileSize
new4.28 KB

Alright, I'm getting this too.

hook_nodeapi update is being called twice on node save.

If I dump the node in each, changes are not persistent across execution of nodeapi update.

That means the node is being regenerated by the form and submitted twice.

I assume this is some contrib module, because it seems unlikely this is also a core bug. Attached is my listing of enabled modules.

glass.dimly’s picture

I'm going to fess up here and admit that this was caused by a syntax error, for posterity.

switch ($op) {
    case 'validate':
    break;

Break statement missing.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.