function _node_save_revision
7.x node.module | _node_save_revision($node, $uid, $update = NULL) |
6.x node.module | _node_save_revision(&$node, $uid, $update = NULL) |
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 drupal-7.x/
modules/ node/ node.module - Saves changes to a node or adds a new node.
File
- drupal-7.x/
modules/ node/ node.module, line 1214 - The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.
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;
}