I like this module and think it elegantly solves a thorny problem. Thus, I am dropping some similar functionality from OG and referring people to this module. See http://drupal.org/node/164070. Be prepared for some more users!

I have a few notes after reading the code:
- og_audience_build_form_submit() should really do a node_load(), change the groups, and then node_save(). that way, actions and other modules will learn about the group change. if there is a problem doing this, lets discuss.
- i think that og_audience_form_alter() wil not be needed in OG 5.x.4 since i will not allow editing of audience by non admins.
- og_audience_build_form() copies some code from OG. if possible, submit a refactoring patch to OG so you don't have to do that.

Comments

David Lesieur’s picture

Thanks for the advices, Moshe! I'll try to implement them soon. You also have commit access to the module, in case you need to change anything.

David Lesieur’s picture

@Moshe: Your last two recommendations are now fixed for sure. But for the first one I'd need to investigate further. At the moment, OG Audience does the following to save group assignments:

    og_save_ancestry($node);
    node_access_acquire_grants($node);
    cache_clear_all();
David Lesieur’s picture

Version: 5.x-1.0 » 6.x-1.x-dev

Two items fixed in 6.x, to be clear.

David Lesieur’s picture

Title: Preparing for OG 5.x.4 (very soon) » Use node_save() for saving audience changes
David Lesieur’s picture

Alternatively, perhaps we could invoke hook_nodeapi() directly from OG Audience, with $op = 'update'.

gustav’s picture

Invoking hook_nodeapi() looks like a good solution to me. That would allow the trigger module to trigger actions when the audience gets updated.