[development] programmatically UPDATE a node won't work: bug or feature?

Jeff Eaton jeff at viapositiva.net
Thu Sep 7 12:13:06 UTC 2006


Augustin,

That's a good catch. $_POST is indeed not set when programmatically 
submitting. and from the looks of it, node_validate() is just plain 
broken for this case.

This is one of the things that was fixed by Moshe's patch to the 
submission/nodeapi/etc handlers. It's understood why it was rolled back 
before the code freeze, but this will take some puzzling over to fix 
without breaking other stuff. Is there an issue logged for it?

--Jeff

Augustin (Beginner) wrote:
> Hello again,
>
>       $node = (array) node_load($nid);
>
>       $values['title'] = $question['q_desc'];
>       $values['body'] = theme('demexp_question_body', $question);
>       //  $values['changed'] = time();
>       drupal_execute('demexp_question_node_form', $values, $node);
>
> but drupal_execute fails.
> I get: "This content has been modified by another user, changes cannot be 
> saved." which comes from here:
>
>   if (isset($node->nid) && (node_last_changed($node->nid) > 
> $_POST['changed'])) {	
>     form_set_error('changed', t('This content has been modified by another 
> user, changes cannot be saved.'));
>   }
>
> now, with the FAPI push method, $_POST is not set, is it?
> so the check above always fail.
>
>   



More information about the development mailing list