I'm using D7 and have a php script that needs to add data programmatically to be displayed on a page on my site.
I believe I have my script set up correctly in that it is writing a node out to the correct database, with most of the information I add to my node.
My problem is that it seems that I can create the node without much problem and add data to the basic node fields, but I cannot convince D7 to store my added field data. The added fields seem to be defined correctly in the database, but I fear I'm not setting the value correctly before I call node_save($my_node).
I've tried adding my data to the fields directly like:
$node->my_field = 'random text'
and that hasn't worked.
I've also tried using an array with the content set as the value like this:
$node->my_story_body[0]['value'] = 'nice Body';
It seems to me that I just can't get the right configuration to add my fields to the node so that the CKK fields get stored correctly. When I edit the node/page that's created from the node_save I can add data to the fields through the UI, but can't seem to get it programmatically.
Thanks in advance for any help,
kevin
Here's a snippet from what I think is my offending code:
$node = new stdClass();
//All these fields save just fine
$node->type = 'my_type';
$node->status = 1;
$node->uid = 1;