Articles


How to add a Rule condition for user specified role Drupal 7

How to add a Rule condition for user specified role Drupal 7



Posted byUttam Kotekar,25th Jan 2016

In my previous post, we have discussed about creating a rule condition programmatically for checking specified role. In this post lets see how we can do the same job without writing a single peice of code. Yes, Drupal rules already provides an condition info to check for user specified role.

Initially you need to create a Rule event, you either create via config (admin/config/workflow/rules/reaction/add) or you can refer this article : create rule event programmatically. Once the Rule event is created, Under the "condition" section, click on the "Add condition" and you will be directed to "Add conditon info" page where you need to select "User has role(s)" under "User" section. Once continue, you see the interface where you can select user roles. Select any role and save it. Thats it check your functionality. Please see the below screenshots for the clarity.

Categories