Quoting Ashraf Amayreh <mistknight@gmail.com>:
Just wanted to point that this is just dummy code so no one thinks it's actually anything related to the aggregation module itself. But the new release will follow a similar pattern, unless I get feedback on a better way to do it :)
On Sat, Mar 8, 2008 at 8:30 PM, Ashraf Amayreh <mistknight@gmail.com> wrote:
For better or worse, this is the code I use in the aggregation module and it seems to be working flawlessly. This is in the yet to be released release though (drupal 5). If there's a better way I'd be glad to know it.
(INSERT) $node = new stdClass(); $node->title = "{$XML->name}"; $node->body = "{$XML->description}"; $node->eid = $eid;
node_save($node); module_invoke_all('nodeapi', $node, 'insert', NULL, NULL);
-------------- (UPDATE) $node = node_load(array('nid' => 5)); $node->title = "{$XML->name}"; $node->body = "{$XML->description}"; $node->eid = $eid;
node_save($node); module_invoke_all('nodeapi', $node, 'update', NULL, NULL);
http://api.drupal.org/api/function/node_save already calls the module hooks for nodeapi via http://api.drupal.org/api/function/node_invoke_nodeapi before returning. Therefore your module_invoke_all isn't needed. Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/