? spaces.og_privacy_change.patch
Index: spaces_og.api.php
===================================================================
RCS file: spaces_og.api.php
diff -N spaces_og.api.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ spaces_og.api.php	3 Sep 2010 17:19:20 -0000
@@ -0,0 +1,32 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ *  API examples for Spaces OG module.
+ */
+
+/**
+ * Signal to other modules that the group's privacy settings are changing.
+ *
+ * This allows other modules can react to the specific change as needed.
+ *
+ * @param $privacy
+ *  Integer. '1' indicates a private group, '0' indicates a public group.
+ * @param $node
+ *  The $node object just updated to the database. At this point the node has
+ *  not been updated to the latest privacy settings.
+ * @param $space
+ *  The $space object just updated with the node.
+ */
+function hook_spaces_og_preset_privacy_change($privacy, $node, $space) {
+  // If the space is going public, force blog to stay private.
+  if (!$privacy) {
+    db_query("UPDATE {og_access_post} og_p 
+              INNER JOIN {og_ancestry} og_a ON og_p.nid = og_a.nid
+              INNER JOIN {node} n ON og_p.nid = n.nid
+              SET og_public = 0 WHERE og_a.group_nid = %d
+              AND n.type = 'blog'",
+              $node->nid);
+  }
+}
Index: spaces_og.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/spaces/spaces_og/Attic/spaces_og.module,v
retrieving revision 1.1.2.29.2.24.2.26
diff -u -p -r1.1.2.29.2.24.2.26 spaces_og.module
--- spaces_og.module	23 Aug 2010 18:43:35 -0000	1.1.2.29.2.24.2.26
+++ spaces_og.module	3 Sep 2010 17:19:20 -0000
@@ -259,6 +259,7 @@ function spaces_og_nodeapi(&$node, $op, 
                       INNER JOIN {node} n ON og_p.nid = n.nid
                       SET og_public = %d WHERE og_a.group_nid = %d",
                       !$private, $node->nid);
+            module_invoke_all('spaces_og_preset_privacy_change', $private, $node, $space);
             node_access_needs_rebuild(TRUE);
           }
           $node->og_private = $private === NULL ? FALSE : $private;
