node_object_prepare() should not assume the present logged-in user.
if (!isset($node->nid) || isset($node->is_new)) {
// ...
global $user;
$node->uid = $user->uid;
}
Looking more into this, it assumes a lot. The function says it is for edit forms but it still seems very useful for programmatic node creation- should it be refactored?
Comments
Comment #1
pillarsdotnet commentedIf you are creating a node on behalf of another user, why not just change the
$node->uidproperty after creation?