_node_save_revision

Versions
6
_node_save_revision(&$node, $uid, $update = NULL)
7
_node_save_revision($node, $uid, $update = NULL)

Helper function to save a revision with the uid of the current user.

Node is taken by reference, becuse drupal_write_record() updates the $node with the revision id, and we need to pass that back to the caller.

Code

modules/node/node.module, line 943

<?php
function _node_save_revision(&$node, $uid, $update = NULL) {
  $temp_uid = $node->uid;
  $node->uid = $uid;
  if (isset($update)) {
    drupal_write_record('node_revisions', $node, $update);
  }
  else {
    drupal_write_record('node_revisions', $node);
  }
  $node->uid = $temp_uid;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.