The node_factory module does not work for drupal 6.
Anybody an idea how this works under drupal 6 or knows a module/file where I could look into to find out how to create a node.
I have a problem with the vid field, which is not populated.

Comments

tomdeb’s picture

this comment is still correct in D6:

http://drupal.org/node/32597#comment-201126

t o m

specto’s picture

Nice example from the devel_generate module.
Look for devel_generate_content_add_node.


  $node->type = "your_content_type";
  
  //There came the surprise for me:
  module_load_include('inc', 'node', 'node.pages');

  //The following appends the current user id for creator, 
  //also sets default promote and publish flags, and sets the current creation time
  node_object_prepare($node);

  $node->title = "Your title";
  $node->body = "The body";
  $node->teaser = node_teaser($node->body);
  $node->language = '';

  node_save($node);