Hi,

I am trying to setup a rule that will prevent "writers" (user role) to edit a node once the status field (field list) is set to "review" or "published". I have been re-searching the topic in the last 3 days and I haven't find a good solution.

Will the path (http://drupal.org/node/762450#comment-3755168) help me?

I also used the PHP filter as recommended here (http://drupal.stackexchange.com/questions/7783/how-to-discard-changes-in...) , but I think it is a little bit over killing.

Ideas?

Thank you,
Emil

Comments

emilorol’s picture

Hi

In case someone else is looking for a similar solution here is what I did to solve the issue. I coded an small module to include the posted patch and by using a module I don't have to worry about patching the roles module every time there is an update.

MY-MODULE

<?php

/**
 *  Implements hook_node_event_info()
 */
function MY-MODULE_node_event_info() {
$items = array(  
  'node_prepare' => array(
  'label' => t('Content is going to be edited'),
  'group' => t('Node'),
  'variables' => rules_events_node_variables(t('edited content'), TRUE),
  'access callback' => 'rules_node_integration_access',
  ),
);
return $items;
}

function MY-MODULE_node_prepare($node) {
  rules_invoke_event('node_prepare', $node);
}

?>
?>

Thank you,

Emil

TR’s picture

Issue summary: View changes
Status: Active » Fixed

#1 provides a solution. Or you can help out with #762450: Event: Content is going to be edited and get that committed if you don't want to use your own code like #1.

TR’s picture

Status: Fixed » Closed (fixed)