1

Is it possible to run a rule on every user triggered when the cron runs.

I need to check every users subscription stutus (commerce subscription module) and if the subscription has expired downgrade their role.

I was hoping the module had this feature but apparently not.

Can this be done?

Cybercampbell
  • 2,486
  • 11
  • 48
  • 75

2 Answers2

3

Sure, make your rule as normal, write a small custom module and implement hook_cron() to run rules_invoke_event().

function MYMODULE_cron() {
  rules_invoke_event('rule_name', $arg1, $arg2, $argN);
}
apaderno
  • 28,547
  • 16
  • 75
  • 90
Clive
  • 36,918
  • 8
  • 87
  • 113
1

Outdated answer. It's now possible to select "Cron maintenance tasks" when selecting what triggers the rule.

Alberto
  • 880
  • 5
  • 15