You are here

function og_is_group_default_access in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og.module \og_is_group_default_access()

Check if group should use default roles and permissions.

Parameters

$group_type: The entity type of the group.

$gid: The group ID or the group entity.

Return value

TRUE if group should use default roles and permissions.

10 calls to og_is_group_default_access()
og_entity_insert in ./og.module
Implements hook_entity_insert().
og_entity_update in ./og.module
Implements hook_entity_update().
og_get_user_roles in ./og.module
Get all roles of a user in a certain group.
og_roles in ./og.module
Retrieve an array of roles matching specified conditions.
og_ui_admin_permissions in og_ui/og_ui.admin.inc
Menu callback: administer permissions.

... See full list

File

./og.module, line 2612
Enable users to create and manage groups with roles and permissions.

Code

function og_is_group_default_access($group_type, $gid) {
  $wrapper = entity_metadata_wrapper($group_type, $gid);
  $bundle = $wrapper
    ->getBundle();
  if (!field_info_instance($group_type, OG_DEFAULT_ACCESS_FIELD, $bundle)) {
    return variable_get("og_is_group_default_access__{$group_type}__{$bundle}", TRUE);
  }
  if (empty($wrapper->{OG_DEFAULT_ACCESS_FIELD})) {
    return TRUE;
  }
  return !$wrapper->{OG_DEFAULT_ACCESS_FIELD}
    ->value();
}