Hi everyone,

I'm currently creating a community site using Drupal 4.7 and one of the requirements they have is when a group is created, an FAQ 'book' is also created. However, I'm not exactly sure on how to create a book related to the group at the same time a group is created. I've tried to look through the API if something like that is possible, and gone through the forums with no luck so far. However, some of you might have already experienced this before and thus might know of ways to tackle the problem.

Comments

btmash’s picture

I was finally able to get the ball rolling after just trying to sift through the node module. Simply put, it would be something like:

$node = new StdClass();
      $node->type = 'book';
      $node->uid = $user->uid;
      $node->status = 1;  // Set to 0 if you do not want the content published
      $node->promote = 0;  // Set to 1 if you do not want the content promoted to the front page
      $node->sticky = 0;  // Set to 1 if you do not want the content sticky
      $node->title = 'Question and Answer area';
      $node->body = 'Please insert some proper question and answers for this section';
      $node->teaser = 'Please insert some proper question and answers for this section';
      node_save($node);
      $nid = $node->nid;

I'm trying to figure out how to "link" the created node to the node that would be created...anyone have any ideas?