13

When a node is edited I want to always create a new revision. I do not want people to be able to turn this off. How can I do this?

1
  • admin/content/node-type/[node-type] look at 'Process' fieldset
    – dobeerman
    Commented Apr 13, 2011 at 2:22

2 Answers 2

17

To enabled automatic revision creation go to the content type page (admin/content/node-type) and select edit for whatever content type you wish to have revision created automatically.

Under the workflow fieldset there's going to be an option "Create new revision" make sure you check that box and save your content type settings.

Now under your permissions (admin/user/permissions) be sure to not to give your users the "administer nodes" permission. This will prevent them from overwriting that option.

2
  • Is this for drupal 6 only?
    – Sam Becker
    Commented Jun 28, 2011 at 3:59
  • This works for D7 as well. Check also Revisioning module, which allows the control over the workflow. Commented Sep 4, 2012 at 11:39
2

There's a few different ways to do this. Assuming you want to avoid to disable the administer nodes permission for users, the easiest way is probably to turn off access to the Create new revision checkbox creating a custom module with the following code.

function sandbox_form_alter(&$form, &$form_state, $form_id) {
  // Node forms have an ID of the form CONTENTTYPE_node_form. Modify only those forms.
  if (strstr($form_id, '_node_form') === FALSE) {
    return;
  }

  if (isset($form['revision_information'])) {
    $form['revision_information']['revision']['#access'] = FALSE;
  }
}

In this way, users don't have the ability to change the default value of the checkbox, which is set on the settings page for each content type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.