function og_is_group in Organic groups 7.2
Return TRUE if the entity is acting as a group.
Parameters
$entity_type: The entity type.
$entity: The entity object, or the entity ID.
Return value
TRUE or FALSE if the entity is a group.
25 calls to og_is_group()
- og_access_check_node_access_grants_is_needed in og_access/
og_access.module - Check whether group access changed that require batch processing.
- og_access_node_access_records in og_access/
og_access.module - Implements hook_node_access_records().
- og_context in og_context/
og_context.module - Get or set group context using the menu system.
- og_context_handler_url in og_context/
og_context.module - Context handler; Get groups from node create URL.
- og_entity_delete in ./
og.module - Implements hook_entity_delete().
File
- ./
og.module, line 1829 - Enable users to create and manage groups with roles and permissions.
Code
function og_is_group($entity_type, $entity) {
if (is_numeric($entity)) {
$entity = entity_load_single($entity_type, $entity);
}
if (!$entity) {
// The entity does not exist.
return FALSE;
}
list(, , $bundle) = entity_extract_ids($entity_type, $entity);
if (!field_info_instance($entity_type, OG_GROUP_FIELD, $bundle)) {
return variable_get("og_is_group__{$entity_type}__{$bundle}", FALSE);
}
$items = field_get_items($entity_type, $entity, OG_GROUP_FIELD);
return !empty($items[0]['value']);
}