node_revision_revert

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/node/node.module, строка 1763

Версии
5
node_revision_revert($nid, $revision)

Revert to the revision with the specified revision number. A node and nodeapi 'update' event is triggered (via the node_save() call) when a revision is reverted.

Код

<?php
function node_revision_revert($nid, $revision) {
  global $user;

  $node = node_load($nid, $revision);
  if ((user_access('revert revisions') || user_access('administer nodes')) && node_access('update', $node)) {
    if ($node->vid) {
      return drupal_get_form('node_revision_revert_confirm', $node);
    }
    else {
      drupal_set_message(t('You tried to revert to an invalid revision.'), 'error');
    }
    drupal_goto('node/'. $nid .'/revisions');
  }
  drupal_access_denied();
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему