Hi, I my module has to check if there exists already a node with a specific content, and if it doesn't exist yet, it has to create it. The node is of a specific node type configured by the same module. So the node is not created by the user interface and therefore I can't use the node module functions. Should I create the node record directly via a db_query call, or should I use a node module function that includes other important actions that have to be done?

Comments

gforce301’s picture

use a function from the node module.

Anonymous’s picture

I already looked through the node module code, I found node_save which is also called by node_form_submit. I will copy the code from node _form_submit but without the $form_state parts. Hope this works fine, I will write about the result when I implemented the code.