This is basically a repost of http://drupal.org/node/1254662, but hopefully with a more Rules-focused discussion.
To recap:
Here's my use case:
-
I have a group type called "team."
-
I have a content type called "game."
-
I have a a content type called "announcement." It may optionally be group content. It may optionally refer to a game via nodereference.
-
Teams register for Games via a pair of nodereferences in a content type called Registration (nodereference(team) + nodereference(game) = a registration).
Okay. So, the site manager creates Announcement content and assigns it to a Game. Easy enough! Now, I want to also assign to that Announcement every group (Team) that is Registered for the referenced Game.
I'm looking at the VBO implementation of "add posts to specified groups," but it appears the user must manually select the groups to which the post will be assigned. Is there currently any way to run a View (or a Rule or whatever) that then passes those group selections on automatically? I'm not seeing a way to pass that array of groups to the VBO.
So now I'm wondering if this is possible via Rules directly, without necessarily passing it through VBO. What I'm not really understanding is how to pass an array into Rules (6.x). I assume it's some sort of Set? Honestly my head starts to swim as soon as I start thinking about writing Sets. Who can help? Thank you!
p.
Comments
Well, after hammering away at
Well, after hammering away at all this I think I'm really close to getting it to work via a VBO via Rules. The problem is, I can't seem to nail down how to send the right operational argument to the VBO.
I thought this would do the trick:
return array('groups[]' => 'rendered_view');
Where "rendered_view" is the result of a View I run prior to the VBO, which correctly spits out a list of NIDs of the groups referred to in the article via the Nodereference. But nothing is getting passed that way. I looked at the form that VBO generates; the form name is groups[] and the options are those NIDs. Everything matches! But nothing goes through. :-/
another solution
I have another solution. You can use "action Execute custom PHP code". Custom PHP code helps a lot, but this method is not recommended, because PHP code is stored in a MySQL table and can slow down website and that PHP code won't be in version control.