Skip to content

Instantly share code, notes, and snippets.

@cam8001
Created September 5, 2013 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cam8001/6444485 to your computer and use it in GitHub Desktop.
Save cam8001/6444485 to your computer and use it in GitHub Desktop.
When using Scheduler to publish or unpublish nodes, update most recent node revision to have same author as node.
<?php
/**
* Implements hook_scheduler_api().
*
* @param $node
* The node object being acted upon.
* @param $action
* Action being performed. Either 'publish' or 'unpublish'.
*
* @see _scheduler_publish()
* @see _scheduler_unpublish()
*/
function acquitest_scheduler_api($node, $action) {
// Update the just (un)published revision to have the same author as the node.
db_query('UPDATE {node_revisions} SET uid = %d WHERE nid = %d AND vid = %d', $node->uid, $node->nid, $node->vid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment