diff --git a/commons_groups.module b/commons_groups.module index 1866973..efd5fc8 100644 --- a/commons_groups.module +++ b/commons_groups.module @@ -1030,6 +1030,20 @@ function commons_groups_field_access($op, $field, $entity_type, $entity, $accoun case 'field_og_subscribe_settings': return $op == 'edit'; + + case OG_ACCESS_FIELD: + if ($op == 'view' && module_exists('og_access') && !empty($entity)) { + $access = NULL; + if (module_exists('og_field_access')) { + $access = user_access($entity_type .':' . $entity->type . ':' . 'view ' . OG_ACCESS_FIELD . ' field', $account); + } + else { + $wp = entity_metadata_wrapper($entity_type, $entity); + // OG_ACCESS_FIELD values: public == 0, Private == 1 + $access = user_access('administer group') || !(bool) $wp->{OG_ACCESS_FIELD}->value(); + } + return $access; + } } if (module_exists('og_access') && in_array($field_name, array(OG_CONTENT_ACCESS_FIELD, OG_ACCESS_FIELD))) {