Hi guys,

I'm trying to create a VBO that let’s users with certain privileges flag a node on behalf of other users.

I created a VBO View listing users and I need to provide Rules with the list of users and the node to flag. The users are provided by VBO, but the node is not (I can’t let users specify the node as a parameter manually)

So my question is :

Is it possible to pass on automatically this node ID to Rules?

If not, I could fetch it from the URL which is “/node/%nid/users”. I need to fetch the %nid, how can I do that?

Any help would really be appreciated.

Comments

dwangba’s picture

I finally found a solution!
I can fetch the node to flag from the URL using this PHP code

$path = current_path();
$parts = explode('/', $path);
return $parts[1];

I have the feeling there might be a better solution, but it works.
Thanks for this great module.

itangalo’s picture

-1-
Drupal provides a function arg() that fetches the parts you describe above – using arg(1) would thus save you two lines of code. :-)

-2-
I don't think there is any good way of passing on the node ID to Rules at present, so your approach with getting URL data seems reasonable. There should be better ways, though, but unfortunately not yet.

itangalo’s picture

Status: Active » Fixed
itangalo’s picture

PS: I think menu_get_object() is a better function to use in this case. See http://api.drupal.org/api/drupal/includes--menu.inc/function/menu_get_ob... for more information.

dwangba’s picture

thanks a lot for your answers!

Status: Fixed » Closed (fixed)

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

mitchell’s picture

Component: Miscellaneous » Provided Module Integrations

Updated component.

wickwood’s picture

Dwangba, you said you found a solution but you did say how you automatically passed the second parameter to your VBO rules component. I'm trying to something similar and I can't figure out how pass the second parameter without manual entry.

Any help you or anyone else can provide would be greatly appreciated!

Thanks in advance!
Steve

wickwood’s picture

Version: 7.x-2.0-rc2 » 7.x-2.6
Component: Provided Module Integrations » Rules Core
Issue summary: View changes
Status: Closed (fixed) » Active
wickwood’s picture

I don't know how it was done here, but I was able to solve my problem with a patch to VBO. You can find it and how I did it at the VBO Issue: Let view arguments be passed as parameters to rule set

wickwood’s picture

Status: Active » Closed (fixed)