Prepares node for saving by populating author and creation date.
$node: A node object.
An updated node object.
function node_submit($node) {
// A user might assign the node author by entering a user name in the node
// form, which we then need to translate to a user ID.
if (isset($node->name)) {
if ($account = user_load_by_name($node->name)) {
$node->uid = $account->uid;
}
else {
$node->uid = 0;
}
}
$node->created = !empty($node->date) ? strtotime($node->date) : REQUEST_TIME;
$node->validated = TRUE;
return $node;
}