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
Comment #1
dwangba commentedI finally found a solution!
I can fetch the node to flag from the URL using this PHP code
I have the feeling there might be a better solution, but it works.
Thanks for this great module.
Comment #2
itangalo commented-1-
Drupal provides a function
arg()that fetches the parts you describe above – usingarg(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.
Comment #3
itangalo commentedComment #4
itangalo commentedPS: 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.
Comment #5
dwangba commentedthanks a lot for your answers!
Comment #7
mitchell commentedUpdated component.
Comment #8
wickwood commentedDwangba, 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
Comment #9
wickwood commentedComment #10
wickwood commentedI 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
Comment #11
wickwood commented