Hi,

is there a way I can force users to enter revision informations and create a new revision whenever they edit a page? As long as it is voluntary stuff, none of our users will ever use it :-(

cu,
Frank

Comments

rachel_norfolk’s picture

Yes, I'd be interested in this, too.

I feel like it should be exposed in the /admin/content/node-type/xxx content type edit page. I wonder if it would be possible to write a module to override this...

emerygjr’s picture

I would also like to see this capability of enforcing revisions. The editor should be able to reject the revision but it shoud default to keeping them.

Emery Gordon

Emery Gordon

nicknickoli’s picture

This module < http://drupal.org/project/revision_moderation > allows any node type to keep revisions 'in moderation' until approved by someone with permissions approves them. To require _any particular node field to be required, you'd have to write it into a custom module.

function mymodule_nodeapi(&$node, $op, $a3=null, $a4=null)
{
	switch($op)
	{
	case 'validate':
		 // check long titles
		 if(!empty($a3['nid']['#post']['title']) && strlen($a3['nid']['#post']['title']) > 80) 
		{
			form_set_error('title', 'Please enter a post title under <tt>80</tt> characters');
		}
}
steveray’s picture

I need this too... but I haven't been able to find any way to do it in the existing 6.1

Anonymous’s picture

Ok, I just saw that you can default check the "Create new revision" checkbox ad Administer/Content Management/Content type. Click on "edit" for the desired content type , expand "Workflow settings" and check "Create new revision" at the "Default options".

Then every save will create a new revision. If the user has "administer node" permissions, he is able to deselect the revision checkbox to prevent a revision.

With the help of nickolis comment I will try to add the check if the revision field is empty and reject saving the node. So the user either must type some log text or uncheck the revision checkbox to save without revision.

Anonymous’s picture

Thanks to nickoli! Here we go :-) Unfortunately, I cannot add attachments here, so I have to post the code.

Save this as enforce_revlog.info below sites/all/modules/enforce_revlog/ (or whereever you like to place your modules):

name = Enforce revlog
description = Enforce log messages for every revision
core = 6.x
package = "Other"

Save this as enforce_revlog.module in the same directory:

function enforce_revlog_nodeapi(&$node, $op, $arg = 0){
  
  switch($op)
  {
    case 'validate':
      // if revision is checked and log message is empty, complain.
      if ( $node->revision && empty($node->log) ) {
        if ( user_access('administer nodes'))  
          form_set_error('log', 'Please enter a revision log message or uncheck the revision checkbox.');
        else
          form_set_error('log', 'Please enter a revision log message.');
      }
    }
}

Then enable the "Enforce revlog" module and you are done.

Now when you edit a page and check the revision checkbox, you must also enter a log message (or uncheck the checkbox again) to save the node.

Together with setting "Create revision" to be checked by default (see my former post), every user editing a page will be forced to enter a log message, unless he can uncheck the revision box, which you can control by the "administer node" permission.

This is my first module, so don't beat me if it's buggy or if I violate coding standards :-)

WorldFallz’s picture

This is very useful-- were you planning on applying for cvs access and adding it to the module repository?

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

Eliza’s picture

It was long ago, but I found it and it`s just what I needed! But, will you be so kind, if said A, also say B - how to add simbol, showing that the field is required (little red *)?

Eliza’s picture

Solved