Skip to content

Instantly share code, notes, and snippets.

@ramlev
Created March 24, 2011 21:32
Show Gist options
  • Save ramlev/885942 to your computer and use it in GitHub Desktop.
Save ramlev/885942 to your computer and use it in GitHub Desktop.
// For inserts, we need a new item_id for the item. See the comment a few lines
// below, before we call the content_<op> function.
if ($sOperation === 'insert') {
$aNodeRevision = array(
'nid' => $oNode->nid,
'uid' => $oNode->uid,
'title' => '',
'body' => '',
'teaser' => '',
'log' => '',
);
$oNodeRevision = (object) $aNodeRevision;
drupal_write_record('node_revisions', $oNodeRevision);
$aItem['item_id'] = $oNodeRevision->vid;
db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $oNodeRevision->nid, $oNodeRevision->vid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment