function og_user_access_by_entity in Organic groups 7
Wrapper of og_user_access(); Gets entity ID instead of group ID.
Can be used as a menu access callback.
Parameters
$perm: The permissions name.
$entity_type: The entity type.
$entity: The entity object.
$account: Optioanl; The user related to the action. For example if the operation is "subscribe" then the account will be the subscribing user.
Return value
TRUE if access is allowed, otherise FALSE.
1 string reference to 'og_user_access_by_entity'
- og_ui_menu in og_ui/
og_ui.module - Implements hook_menu().
File
- ./
og.module, line 2171 - Enable users to create and manage groups with roles and permissions.
Code
function og_user_access_by_entity($perm, $entity_type = NULL, $etid = NULL, $account = NULL) {
if (empty($account)) {
global $user;
$account = clone $user;
}
if ($group = og_get_group($entity_type, $etid)) {
return og_user_access($group->gid, $perm, $account);
}
return FALSE;
}