3

How to programmatically retrieve configuration of the specific rule?

I tried

$settings = rules_config_load('RULE_NAME');

It returns very basic info (name, ID etc) and empty "settings" array.

Cant also get it directly from DB .

It is stored in serialized array that can not be fully processed with the unserialize() function

apaderno
  • 28,547
  • 16
  • 75
  • 90
ymakux
  • 3,415
  • 1
  • 34
  • 43

1 Answers1

7

I got the same issue and end up here, here is a solution i found, you need to call actions() on your rule to access settings:

$rule = rules_config_load('RULE_NAME');
foreach ($rule->actions() as $action) {
  $settings[] = $action->settings;
}
Mog
  • 86
  • 1
  • 2