function node_submit
Prepares node for saving by populating author and creation date.
Parameters
$node: A node object.
Return value
An updated node object.
2 calls to node_submit()
- NodeSaveTestCase::testImport in modules/
node/ node.test - Checks whether custom node IDs are saved properly during an import operation.
- node_form_submit_build_node in modules/
node/ node.pages.inc - Updates the form state's node entity by processing this submission's values.
File
-
modules/
node/ node.module, line 1052
Code
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.