Referenced User Roles based on Content Changes

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

How do I create a rule / action set wherein:

  • If a certain TYPE of content is deleted
  • Which HAS a particular taxonomy term
  • All REFERENCED users to the node
  • (excluding the acting user)
  • Will have one or more ROLEs altered?

My use case is as follows:
I have a large set of Sales representatives/distributors, whom each have access to certain data within our site only they may see.
If we delete their Company (content-type) page (and these users have been referenced FROM it), I want to take away their permissions as "sales reps".

Comments

Hah; figured it out. Turns

wjaspers's picture

Hah; figured it out.
Turns out my other test instance has some serious problems in it.
WARNING!!!
Since I had more than one content type which can be affected, I discovered a shared User Reference field CANNOT be reused in RULES.
Make SURE if you have multiple content-types with user references, that each field is separately NAMED.

I was able to set this up (in another, better functioning test instance) by:

In Rules, go to:

  1. Add a new rule
  2. Under Label: set to whatever you like
  3. On event: choose, "After Deleting Content"
  4. Under categories, I entered: "account control"
  5. Make sure "This rule is active..." is checked.
  6. Press save changes
  7. In the ON condition, press add condition
  8. Select "Content Has Type"
  9. Press Next
  10. choose whatever content types this applies to for you
  11. press next
  12. Under DO, press "add an action"
  13. Select User -> "Remove User Role"
  14. Press next
  15. Under "Arguments configuration", select "Referenced User" from "User whos roles should be changed"
  16. Choose the roles you would like to disable!

Works for multiple references?

itangalo's picture

I was going to say that this task will be really tricky, until I read your comment.
Does your method work for multiple references as well? If so, I definately should check this out.

Cheers!
//Johan Falk, NodeOne, Sweden

I haven't had a chance to

wjaspers's picture

I haven't had a chance to test it in depth yet; but, in my better (and more complete) testing instance of Drupal 6, I have separate rules for separate Distributor and Service "Company" content types.
I will assume (until Monday, when I can test it), that it works.
I'd much rather have ONE content type for "Company" and then be able to compare a taxonomy term applied to the node; but the current version of Rules doesn't allow me to have a taxonomy condition.

It works! It works! I also

wjaspers's picture

It works! It works!

I also set up a similar rule so that if I unpublish a certain piece of content, the same effect is produced. Now all I need is to assign the reverse of it.

Its too bad there are no Taxonomy conditions -- otherwise I could really leverage this rule.

EDIT: Shows what I know. Taxonomy conditions are just the use of "Text Comparison" conditions. It would be nice if Taxonomy had its own category.

Rules

Group organizers

Group categories

Categories

Group notifications

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