Index: og.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og/og.module,v retrieving revision 1.298.2.45 diff -u -F^f -r1.298.2.45 og.module --- og.module 28 Feb 2007 21:33:20 -0000 1.298.2.45 +++ og.module 1 Mar 2007 20:06:18 -0000 @@ -1275,6 +1277,9 @@ function og_nodeapi(&$node, $op, $teaser $public = db_result(db_query_range("SELECT is_public FROM {og_ancestry} WHERE nid = %d", $node->nid, 0, 1)); $node->og_public = $public ? TRUE : FALSE; } + else { + $node->og_public = TRUE; + } break; case 'validate': if (og_is_group_type($node->type)) { @@ -1989,11 +2002,13 @@ function og_node_access_records($node) { // we write a broad grant here but og_node_grants() only issues it selectively. $grants[] = array('realm' => 'og_subscriber', 'gid' => $gid, 'grant_view' => 1, 'grant_update' => 1, 'grant_delete' => 1); } + + // if there are no groups we don't override the viewing + if (count($node->og_groups) && $node->og_public) { + $grants[] = array('realm' => 'og_public', 'gid' => 0, 'grant_view' => 1, 'grant_update' => 0, 'grant_delete' => 0); + } } - if ($node->og_public) { - $grants[] = array('realm' => 'og_public', 'gid' => 0, 'grant_view' => 1, 'grant_update' => 0, 'grant_delete' => 0); - } return $grants; }