Event on revision comparison.

Events happening in the community are now at Drupal community events on www.drupal.org.
wipeout_dude's picture

Hi All,

Just started using rules after watching some screencasts etc. as expected I have hit a problem straight out the gates..

I have a content type with an entity reference field referencing a user.. I am using content_access and ACL and I want a rule that will update the permissions granting view and edit permission to the referenced user..

I have it working if I reset the permissions to those of the content type and then add view and edit permission to the referenced user.. The problem is that this would remove any manually added permissions as well..

What I would like to do is create a rule that would somehow check if the field has changed.. So..

If the field has changed..
revoke existing access permission for the old reference user
and
grant permission to the new user

or

If field is now empty..
revoke existing access permission for the old user

The issue is I can't figure out how to evaluate if the contents of the field has changed.. I tried enabling revisions for that content type but that didn't help.. I will also need to tell the rule what the old value and new values are in order to revoke and grant the appropriate permission..

Any pointers would be appreciated..

Thanks..

Comments

I worked it out.. I had to

wipeout_dude's picture

I worked it out.. I had to trigger the rule on "Before saving content" to be able to compare the old and new versions..

Seems so simple when you know.. :)

^

ayesh's picture

You can do even after saving content as well. New content and unchanged content both available to play.

Seems so simple when you know.. :)

-- I'm a Sherlock Holmes fan and I can remember Dr. John Watson :)

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week