Hi,
I'm working on a little module which opens a forum topic for each story you create. The story shows a link to the forum topic in place of the comments system and the forum topic shows the teaser of the story and a link back to this story.
The idea is to bring integration between articles and forums and having a specific forum which contains all the news discussion.
I'm trying to use Drupal's nodeapi so as to make this compatible with any type of node and node_save() so as to avoid having to deal with lower-level database calls.
Here are the two main problems I encountered during the development of this module. Any help would be welcome.
PROBLEM #1: using node_save() in a nodeapi 'insert' operation
The nodeapi hook performs actions when a node is submited, inserted, deleted, updated and viewed and node_save() takes a StdClass with the node's properties and creates the node.
I first tried with the submit operation of nodeapi and everything worked fine with the creation of the forum topic but I discovered that submit is also called when I modify a node so I tried with insert. Resulting in forum topics duplicating on each node modification.