views_bulk_operations_action (or some related function) seems unable to get any context when calling it programatically.

Example from clean install with Drupal 6.16, VBO 1.9 and Rules 1.1 (plus helper modules CCK 2.6, Token 1.12, Devel 1.18, Features 1.0-beta6 and Views 2.8):
* VBO with operation to publish selected nodes, and an argument on node reference
* A Triggered Rule acting on node save, calling VBO and passing along nid as argument

Expected effect: Nodes referring to the saved node are published
Actual effect: No context or object available to use on Rules configuration page, get_defined_vars() more or less empty

I included two configurable messages to be sure that the context exists both before and after VBO is called.
The example is shown in attached screenshots, and can be reproduced by enabling the attached feature.

Comments

infojunkie’s picture

Thanks for the report. I was able to reproduce this bug and I am working on it.

itangalo’s picture

A little more info: It seems that it works fine to use the Rules action "Execute arbitrary PHP code" and call the function views_bulk_operations_execute manually.

It could be a workaround for people wanting to call VBO programatically, and perhaps also shed some light on the bug above.

apemantus’s picture

subscribe - I have also just encountered this issue and am currently using Italango's workaround

infojunkie’s picture

Version: 6.x-1.9 » 6.x-1.x-dev
Status: Active » Fixed

Fixed in the latest dev. Please try it 12 hours from now or get from CVS DRUPAL-6--1 branch. You will need to refresh the cache and re-create the VBO action in your existing rules.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

itangalo’s picture

I've tried the dev version and can confirm that the variables are now passed on from VBO to Rules.

Rejoice!

itangalo’s picture

Status: Closed (fixed) » Needs review

Hello again

I have tried the dev version again, and I can no longer reach the $context or $object variables. :-(

I'm marking this as 'needs review', and will get back when I have double checked everything on a clean install. Sorry about the bad news.

itangalo’s picture

Status: Needs review » Closed (fixed)

Ok, I have now done some further checking.

When configuring everything in a straight line it seems to work fine, and the $object and $context are available.
However, when trying to edit and resave a VBO action there is some kind of PHP error and you get a blank screen.

The issue is reported here: http://drupal.org/node/914028

adraskoy’s picture

subscribe

kevin.mcnamee@mailbox.org’s picture

Version: 6.x-1.x-dev » 6.x-1.13
Status: Closed (fixed) » Needs work

I do not have any blank screen errors as per #914028: 'Execute a VBO programmatically on node' actions can't be edited and resaved. That issue seems to be solved, but I am still missing the context when executing a VBO from Rules.

/Kevin