Created
September 5, 2013 00:16
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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