So I have the following function in my drupal module.
I want to submit the product as unpublished. I guess I will need to put
->condition('n.status', '1')
I just do not know where to put it.
Here is my method.
function products_add(){
global $user;
$products = create('products');
return drupal_get_form('products_form', $products);
}
That code alone will not publish a node. To understand why you need to read http://drupal.org/node/310069
Also, the function product_add() is not where you should be doing this anyway. You need to use hook_form_alter() on the form products_form, and then default the published status to TRUE. Or, you could probably set this by doing $node->status = NODE_PUBLISHED; in hook_node_presave(). Or, you could also do something similar in hook_entity_presave().