OG - Apply membership to children I'm wondering if there is en option to apply og membership to all the entity referenced children of an node.

I have a content type 'Enterprise' which can reference itself to create a structure of enterprises. F.e. (Enterprise 1 --> Subenterprise 1 --> Subsubenterprise 1)

When enterprise 1 is added to a group all dependent nodes should be added also.

Thanks in advance for your advice
You can do that with Views Rules.


Create a view that gives all directly referred children of a node (with the node as contextual filter), give it a "Rules" display.
Now create a Rules component that takes as argument a node, runs a "View Loop" (you'll see what that is as soon as you've installed the above mentioned module) over your newly created view.
To this loop, add an action that adds the current loop item to your organic group. Save the component.
Add a second action to the loop, which is the component itself, with the current loop item as an argument. (I haven't actually tried this.)
You can call this rule component from within other rules that you can trigger in many ways, say by clicking a simple button or by performing a bulk operation.


My two cents:


Be careful with this, since it is recursive. If you have two enterprises linking each other, then this will recurse infinitely and crash. Maybe add as a precondition in the rule component that the node is not yet a member of the group.
Decide whether you want to use entity references or organic groups for this, but don't use both. What you're trying to do sounds a lot like you have a network of enterprises and sub-enterprises and you want to translate your existing network into organic groups. If someone adds new references, you'll have to update your groups, which is annoying. Decide between entity references and organic groups and get rid of the other.