In this context, there is a general error, regardless of whether you use the trigger or Mike Manrose's suggestion via hook_nodeapi() (+1):
As long as your export logic runs on the same page loop that handled the update and uses node_load() to retrieve the node data, node_load() can return a statically cached version of node from before the update, which does not yet contain any changes . If this is a problem in your case, you can work around it in two ways:
node_load() node static cache reset by passing TRUE as the third parameter to node_load() . This would ensure that the node is populated only from the database (at the price of some extra db requests, so keep in mind the potential performance impact).- If you follow the
hook_nodeapi() route, you can avoid the need to call node_load() altogether if you pass in the $node object that is available directly to your export function, as this will represent the updated state.
Henrik Opel
source share