Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I use the Action 'Fetch entity by property' and select fetch a user by role, when the action is fired I get this error:
Warning: array_values() expects parameter 1 to be array, null given in rules_action_entity_query() (line 56 of /sites/all/modules/contrib/rules/modules/entity.eval.inc).
Any thoughts what might be the issue?
Comments
Comment #1
qasimzee CreditAttribution: qasimzee commentedping. exactly facing the same issue
Comment #2
chirhotec CreditAttribution: chirhotec commented+1. Same exact problem.
Comment #3
chirhotec CreditAttribution: chirhotec commentedA temporary work around I've been able to do is to use Views and Views Rules, to create a list of users filtered by role, and then loop on that list within rules.
Comment #4
maximpodorov CreditAttribution: maximpodorov commentedFetching users by role is impossible currently. This is Entity API limitation (inability to query user properties which are not stored in users table itself).
Comment #5
maximpodorov CreditAttribution: maximpodorov commented#2152807: Fetch users by roles
Comment #6
bobfries CreditAttribution: bobfries commentedTo work around this you need to use a component in the rule.... So fetch ALL the users (or in my case I fetched all users by status: Active), then loop them and run a component. Then in the component you can check the user role before doing whatever you need to do.
THE MAIN RULE:
THE COMPONENT:
Comment #7
TR CreditAttribution: TR commentedAs noted in #5, this is blocked by #2152807: Fetch users by roles