function vud_access_callback in Vote Up/Down 7
Same name and namespace in other branches
- 6.3 vud.module \vud_access_callback()
- 7.2 vud.module \vud_access_callback()
Access callback for votes.
Parameters
$perm: A string containing the permission required to modify the vote.
$entity_type: A string containing the type of content being voted on.
$entity_id: An integer containing the unique ID of the content being voted on.
$value: An integer containing the vote value, 1 for an up vote, -1 for a down vote.
$tag: A string containing the voting API tag. $param $account An object containing the user voting on the content, NULL for the current user.
Return value
A boolean flagging whether or not the user has access to the vote.
1 call to vud_access_callback()
- vud_widget_proxy in ./
vud.theme.inc - Proxy widget function that hook_theme() calls.
1 string reference to 'vud_access_callback'
- vud_menu in ./
vud.module - Implementation of hook_menu().
File
- ./
vud.module, line 114 - Implements the core voting module on top of Voting API.
Code
function vud_access_callback($perm, $entity_type, $entity_id, $value, $tag, $account = NULL) {
if ($account === NULL) {
global $user;
$account = $user;
}
// If user do not pass system permissions, deny soon.
if (user_access($perm, $account) !== TRUE) {
return FALSE;
}
// Invokes hook_vud_access(), gives modules ability to allow or disallow access.
$access_array = module_invoke_all('vud_access', $perm, $entity_type, $entity_id, $value, $tag, $account);
foreach ($access_array as $access_result) {
// If one hook implementation want to deny, end there.
if ($access_result !== TRUE) {
return FALSE;
}
}
// If we are here, account should pass.
return TRUE;
}