Hi,

I have the following code:

 // Save the node, so that we have a node id
$node->status = NODE_PUBLISHED;
    node_save($node);

    // Specify some data based on the newly created team id
    $node_path = 'teams/1'.str_pad($node->nid.'', 5, '0', STR_PAD_LEFT);
    
    // Disable pathauto, because we want to create our own aliases for teams
    $node->path = array('pathauto' => FALSE, 'alias' => $team_path);
    
    // Save the node once again
    $node->status = NODE_PUBLISHED;
    node_save($node);

main idea here is that I want both the node to be published, as the $node-path being set with my own logic (which requires the node id)

But when I execute this code, the node is not published.

If i remove one of both node_save(), then the node will be published, but my own $node->path functionality is then obviously broken.

Any clue why this is happening and how to solve it ?