You are here

function _revisioning_publish_latest_revision in Revisioning 6.3

Same name and namespace in other branches
  1. 8 revisioning_api.inc \_revisioning_publish_latest_revision()
  2. 6.4 revisioning_api.inc \_revisioning_publish_latest_revision()
  3. 7 revisioning_api.inc \_revisioning_publish_latest_revision()

Find the most recent pending revision, make it current, unless it already is and publish node. Note that no check is made as to whether the initiating user has permission to publish this node.

Parameters

$node: The node object whose latest pending revision is to be published

Return value

TRUE if operation was successful, FALSE if there is no pending revision to publish

2 calls to _revisioning_publish_latest_revision()
revisioning_publish_latest_revision_action in ./revisioning_triggers_actions.inc
Implementation of publish_latest_revision action
revisioning_rules_action_publish_latest in ./revisioning.rules.inc
Action: publish most recent pending revision.

File

./revisioning_api.inc, line 377
API functions of Revisioning module

Code

function _revisioning_publish_latest_revision(&$node) {

  // Get latest pending revision or take the current provided it's UNpublished
  $latest_pending = array_shift(_revisioning_get_pending_revisions($node->nid));
  if (!$latest_pending) {
    if (!$node->status && $node->is_current) {
      _revisioning_publish_revision($node);
      return TRUE;
    }
  }
  else {
    _revisioning_publish_revision($node->nid, $latest_pending->vid);
    return TRUE;
  }
  return FALSE;
}