function _node_save_revision
Helper function to save a revision with the uid of the current user.
The resulting revision ID is available afterward in $node->vid.
Parameters
$node: A node object.
$uid: The current user's UID.
$update: (optional) An array of primary keys' field names to update.
1 call to _node_save_revision()
- node_save in modules/
node/ node.module - Saves changes to a node or adds a new node.
File
-
modules/
node/ node.module, line 1215
Code
function _node_save_revision($node, $uid, $update = NULL) {
$temp_uid = $node->uid;
$node->uid = $uid;
if (isset($update)) {
drupal_write_record('node_revision', $node, $update);
}
else {
drupal_write_record('node_revision', $node);
}
// Have node object still show node owner's uid, not revision author's.
$node->uid = $temp_uid;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.