I'm creating nodes from XML using the Feeds module (great module BTW).
function boardgamegeek_menu() {
$items['games/add/%/%'] = array(
'title' => 'Boardgamegeek add game',
'description' => 'Boardgamegeek add game',
'page arguments' => array(2, 3),
'page callback' => 'boardgamegeek_add',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
function boardgamegeek_add($objectid, $title) {
$node = new stdClass();
$node->type = 'boardgame';
$node->title = $title;
$node->feeds['FeedsHTTPFetcher']['source'] = 'http://www.boardgamegeek.com/xmlapi/boardgame/' . $objectid;
node_save($node);
/*
// This does an import
$myFeed = feeds_source('game_importer');
while (FEEDS_BATCH_COMPLETE != $myFeed->import());
*/
return 'http://www.boardgamegeek.com/xmlapi/boardgame/' . $objectid;
}
When I run this code, a node is created with a title field value from $title (that's exactly what I want). The import doesn't start automatically, and when I start the import myself, another node is being created without any title.
I would like to update the node I created...
The feed_nid and the entity_id should be the same. The feed_nid is the node id from the node I created, the entity id is the node id feeds created.
Any ideas?