| Versionen | |
|---|---|
| drupal6 | _node_save_revision(&$node, $uid, $update = NULL) |
| drupal7 | _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.
modules/
<?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;
}
?>
Kommentare
Kommentar hinzufügen