Ah, this is unnerving me. I have done this before without problem but now I am getting a WSOD with an empty error.log. I am simply trying to create a node and pass a nid to a node reference field. It works find if I comment out the node reference assignement. BUT, if I leave it open, I get a WSOD. Interestingly, if I go back and look at newly created node, it in fact does get the node rerference.

<?php
function ucnc_document_makecredit($nodeid){
    $node = new stdClass();
    $node->title = "Your node title";
    $node->body = "The body text of your node.";
    $node->type = 'credit_letter';
    $node->created = time();
    $node->changed = $node->created;
    $node->status = 1;          // Published?
    $node->promote = 0;       // Display on front page?
    $node->sticky = 0;          // Display top of page?
    $node->format = 1;         // Filtered HTML?
    $node->uid = 1;             //  Content owner uid (author)?
    $node->language = 'en';
    $node->field_credit_seminar[0]['nid'] = $nodeid;
    node_submit($node);
    node_save($node);
    drupal_goto('node/' . $node->nid . '/edit');
?>

I have tried it using node_execute and get the same problem, so I tried node_save and still.. it's not working as it appears it should. All help apprecaited. Thank you.

Comments

tpainton’s picture

This appears to be a bug with Automatic Node Titles.

If I disable, everything works fine. reporting to que.

tpainton’s picture

Watchdog report Headers already sent.. Traced it back to devel themer. Disabling devel themer also fixes the problem.