function og_load_entity in Organic groups 7
Return a re-loaded entity with its fields.
This is needed for example if a user account is passed, as global $user is only a partial user entity, or only a partial entity object was sent.
Parameters
$entity_type: The entity type.
$entity: The entity.
5 calls to og_load_entity()
- og_get_entity_groups in ./
og.module - Get the groups a content is associated with.
- og_get_entity_state in ./
og.module - Get the state of an entity in a group.
- og_group in ./
og.module - Set an association (e.g. subscribe) an entity to a group.
- og_is_member in ./
og.module - Return TRUE if entity belongs to a group.
- og_ungroup in ./
og.module - Delete an association (e.g. unsubscribe) of an entity to a group.
File
- ./
og.module, line 3031 - Enable users to create and manage groups with roles and permissions.
Code
function og_load_entity($entity_type, $entity) {
list($id) = entity_extract_ids($entity_type, $entity);
$entity = entity_load($entity_type, array(
$id,
));
return reset($entity);
}