Helper function to save a revision with the uid of the current user.
The resulting revision ID is available afterward in $node->vid.
$node: A node object.
$uid: The current user's UID.
$update: (optional) An array of primary keys' field names to update.
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;
}