You are here

function og_is_group_default_access in Organic groups 7

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

Check if group should use default roles and permissions.

Parameters

$gid: The group ID.

Return value

TRUE if group should use default roles and permissions.

7 calls to og_is_group_default_access()
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_og_ui_get_group_admin in og_ui/og_ui.module
Implementation of hook_og_ui_get_group_admin()
og_ui_user_admin_permissions in og_ui/og_ui.admin.inc
Menu callback: administer permissions.
og_ui_user_admin_permissions_after_build in og_ui/og_ui.admin.inc
Helper function to disable the permissions checkboxes.

... See full list

File

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

Code

function og_is_group_default_access($gid) {
  $return = TRUE;
  $property = OG_DEFAULT_ACCESS_FIELD;

  // For performance reasons, do not bother loading the group and entity unless
  // the field exists.
  if (field_info_field($property) && ($group = og_load($gid)) && ($entity = $group
    ->getEntity())) {
    if (!empty($entity->{$property}[LANGUAGE_NONE]) && ($wrapper = $entity->{$property}[LANGUAGE_NONE])) {
      $return = empty($wrapper[0]['value']);
    }
  }
  return $return;
}