I've read all the issue posts I could find on how to set this up and still cannot get it to work.
I am running og 7.x-2.7+30-dev with Drupal 7.36.

I created the 'Group' content type and configured it as a group.
I added the 'Group Visibility' field to the 'Group' bundle.

I created the 'Group Forum' content type and configured it as a group content.
I added the 'Group Content Visibility' field to the 'Group Forum' bundle.

I then edited my existing groups and group content as well as created new groups and group content assigning the visibility to be 'Member Only'. I also rebuilt my permissions.

However, regardless of whatever setting I could find to tweak the Group and Group Content was always visible to both all anonymous and authenticated users.

I also have Content Access 7.x-1.2-beta2 installed with permission open for viewing my 'Group' and 'Group Forum' for both Anonymous and Authenticated users. Is that the problem?

Comments

webservant316’s picture

Hmmm further testing and I think that my 'Group Visibility' settings cannot override the 'Content Access' permission settings. Seems like 'OG Group Visibility' can grant permission to view even if 'Content Access' has not granted permission to view. However, 'OG Group Visibility' cannot revoke permission to view if 'Content Access' has already granted permission to view.

I could live with this with my one Group content type of 'Group Forum' since that content type is ONLY for group content. However, I also have a 'webform' content type that may or may not be linked to a group. When not linked to a group I want the content type to be viewable to all users. However, when linked to a group I want the 'webform' to be viewable or not viewable according to the 'OG Group Visibility' settings.

I wonder if I use 'module_weight' to change the order of 'OG Content Access Control' and 'Content Access' if that will make a difference?

webservant316’s picture

Changing the order of 'OG Content Access Control' and 'Content Access' with 'module_weight' made no difference.

My options at this point...

1. Get a cool tip from this support request.
2. Create yet another content type 'webform2' that is dedicated for Group Content.
3. Require the assignment of Content Access permission PER node for my 'webform'.

Frankly all I am after is to make all my 'Group' pages always visible to everyone and all my 'Group Content' pages only visible to members. Is there an easier way to do this? I thought I saw a hook to override node perms in this case. Perhaps I can find that again.

webservant316’s picture

Wow, I am amazed that I could not use standard OG settings to display the group page to the public and all group content to group members only. Perhaps things were complicated because I use the content_access module. Any way I solved my use case with the hooks below...

/*** OG ACCESS CONTROL ***/
define('CUSTOM_GROUP_REALM', 'custom_group_realm');
define('CUSTOM_WEBFORM_REALM', 'custom_webform_realm');
function custom_node_grants($account, $op) {
	if ($op == 'view') {
		$grants[CUSTOM_GROUP_REALM] = og_get_entity_groups('user', $account->uid);
		$grants[CUSTOM_WEBFORM_REALM] = array(1);
		return $grants;
	}
}
function custom_node_access_records($node) {
	/* determine if group content */
	if ($node->type == 'group_forum' || $node->type == 'webform') {
		$content_groups = og_get_entity_groups('node', $node->nid);

		/* ok we got group content */
		if (!empty($content_groups)) {
			$grant = array(
				'realm' => CUSTOM_GROUP_REALM,
				'gid' => reset($content_groups),
				'grant_view' => 1,
				'grant_update' => 0,
				'grant_delete' => 0,
				'priority' => 0,
			);
			$grants[] = $grant;
			return $grants;
		}

		/* ok we got a non-group webform */
		if ($node->type == 'webform') {
			$grant = array(
				'realm' => CUSTOM_WEBFORM_REALM,
				'gid' => 1,
				'grant_view' => 1,
				'grant_update' => 0,
				'grant_delete' => 0,
				'priority' => 0,
			);
			$grants[] = $grant;
			return $grants;
		}
	}
}