yellow_create_node

Definition

yellow_create_node($bid, $title, $tags = array(), $location = array(), $body = 'placeholder')
yellow/yellow.module, line 361

Description

Create a yellow node on page view

Code

function yellow_create_node($bid, $title, $tags = array(), $location = array(), $body = 'placeholder') {
  if (!empty($bid) && !empty($title)) {
    $node = array();
    // define the default node
    $node['title'] = $title;
    $node['body'] = '';
    $node['teaser'] = '';
    $node['created'] = time();
    $node['comment'] = 2;
    $node['type'] = 'yellow';
    if (variable_get('yellow_tags', 1) == 1 && !empty($tags)) {     
            if (count($tags) > 1) {
        $tags = implode(', ', $tags);
      }
      $vid = variable_get('yellow_vocabulary', 1);
      $node['taxonomy']['tags'][$vid] = $tags;     
          } 
      if (variable_get('yellow_tag_location', 1) == 1 && !empty($location)) {     
            $vid = variable_get('yellow_location_vocabulary', 1);
      $node['taxonomy']['tags'][$vid] = $location;     
          } 
      $node['bid'] = $bid;

    node_submit(&$node);
    node_save(&$node);
    return $node->nid;
  } 
  }