Using vbo actions with rules
| Project: | Views Bulk Operations (VBO) |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
As reported in #372114: Crash with "Modifying node's taxonomy terms" executing vbo action doesn't work with rules. The problem is that rules caches the action info for better performance - so hook_action_info() isn't invoked before the action is executed. As an affect the includes are not included yet...
>I don't understand the relationship between invoking an action from a rule, and including VBO actions inside the rules.inc file. Does the rules.inc file automatically get loaded when a rule fires?
Yep rules automatically includes the .rules.inc when it evaluates some rules.
Proposed fix:
>What about adding some code directly into .rules.inc that includes the action includes of vbo? So once .rules.inc gets included, it would automatically include the actions includes and everything should work.

#1
You can include the following snippet in your rules.rules.inc:
<?php$files = file_scan_directory(drupal_get_path('module', 'views_bulk_operations'), '(.*).action.inc$');
if ($files) foreach ($files as $file) {
require_once($file->filename);
}
?>
or I can put that in my own implementation of hook_init(). Which do you prefer?
#2
I went ahead and included the code above in VBO's hook_init(). This is better because it will let all modules that deal with actions use the VBO ones.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.