0

Versions

Drupal 7
Rules 2.9

Problem

I am trying to loop through all users with a given role. I am trying to pull the users using the action "Fetch entity by property" with property "User Roles" But the value does not allow me to enter a static role. It forces me to select some available variable using tokens. If I enter a static value and save it returns a validation error.

How do I set the property to a static role?

Note the role is not the same as the user creating the node.

Rule

I would include a serialized copy of the rule but frankly none of the rest of the rule matters. Roughly:

Trigger: node create.
Condition: node is published.
Action: Grab all users with editor role.
Action: loop through all users and send e-mail or add to a nodequeue (havn't decided which yet).

More info

The documentation seems to indicate I should use "direct" input mode. However that option does not appear to be available on this form. Am I missing something? is this maybe a bug?

1

Answering my own quesiton. I guess I should have found this sooner. But writing it down here helped me process the vocabulary I needed to search for.

I do indeed need to switch to direct input mode. In fact if you switch to direct input mode it will give you a list of roles to select. However direct input mode is not available on initial creation.

To fix simply save as some value (I used site:user:role). Then edit the rule again and direct input will be available. It appears to be a bug listed here: https://www.drupal.org/node/2168961

Thanks and hope this helps someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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