function hook_fivestar_access in Fivestar 8
Same name and namespace in other branches
- 7.2 fivestar.api.php \hook_fivestar_access()
Hook to alter access to voting in Fivestar.
This hook is called before every vote is cast through Fivestar. It allows modules to allow or deny voting on any type of entity, such as nodes, users, or comments.
Parameters
string $entity_type: Type entity.
string $id: Identifier within the type.
string $vote_type: The VotingAPI tag string.
int $uid: The user ID trying to cast the vote.
Return value
bool|null Returns TRUE if voting is supported on this object. Returns NULL if voting is not supported on this object by this module. If needing to absolutely deny all voting on this object, regardless of permissions defined in other modules, return FALSE. Note if all modules return NULL, stating no preference, then access will be denied.
See also
fivestar_validate_target()
1 function implements hook_fivestar_access()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- fivestar_fivestar_access in ./
fivestar.module - Implements hook_fivestar_access().
File
- ./
fivestar.api.php, line 87 - Provides API documentation for the Fivestar module.
Code
function hook_fivestar_access($entity_type, $id, $vote_type, $uid) {
if ($uid == 1) {
// We are never going to allow the admin user to cast a Fivestar vote.
return FALSE;
}
}