By lum12 on
Hi All,
I'm trying to duplicate a node with a function but there is some weird behaviors in UID
function passiva_copia($nid) {
$node = node_load($nid);
global $user;
$newnode = array(
'uid' => $user->uid, // <<< here is the problem
'comment' => 2,
'promote' => 1,
'type' => $node->type,
'status' => $node->status,
'idanag' => $node->idanag,
......
);
drupal_set_message($newnode->uid . " - " . $user->uid );
drupal_set_message return " 0 - 1 "
So it seems that
$newnode = array(
'uid' => $user->uid,
doesn't' work,
My user is UID 1 and I don't have any idea why $user->uid return the correct UID but is not passed to $newnode
is it a bug of 6.x
could someone help please?
thanks in advance
luca