/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if ($order->product_count == 1) { module_load_include('inc', 'node', 'node.pages'); // new for Drupal 6 $form_state['values']['type'] = 'order'; // the type of the node to be created $form_state['values']['status'] = 1; // set the node's status to Published, or set to 0 for unpublished $form_state['values']['title'] = 'Some Node Title Here'; // the node's title // here is the problem. trying to access the array in the previous snipplr link. $form_state['values']['body'] = $updated_order->products[0]->data->attributes['project'][0];// NOT WORKING at the moment. returns empty. // the body, not required $form_state['values']['name'] = 'jacobj'; $form_state['values']['op'] = t('Save'); // this seems to be a required value // call the function to create the node, node_revisions, and CCK values. // Replace "story" with the name of your form / content type $errs = drupal_execute('order_node_form', $form_state, (object) $nodeTmp); }