_node_save_revision

6 node.module _node_save_revision(&$node, $uid, $update = NULL)
7 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.

1 call to _node_save_revision()

File

modules/node/node.module, line 1162
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;
}
Login or register to post comments