function fivestar_validate_target in Fivestar 5
Same name and namespace in other branches
- 6.2 fivestar.module \fivestar_validate_target()
- 6 fivestar.module \fivestar_validate_target()
- 7.2 fivestar.module \fivestar_validate_target()
Check that an item being voted upon is a valid vote.
Parameters
$type: Type of target (currently only node is supported).
$id: Identifier within the type (in this case nid).
$uid: The user trying to cast the vote.
Return value
boolean
3 calls to fivestar_validate_target()
- fivestar_block in ./
fivestar.module - fivestar_nodeapi in ./
fivestar.module - Implementation of hook_nodeapi().
- _fivestar_cast_vote in ./
fivestar.module - Internal function to handle vote casting, flood control, XSS, IP based voting, etc...
File
- ./
fivestar.module, line 776 - A simple n-star voting widget, usable in other forms.
Code
function fivestar_validate_target($type, $id, $uid = NULL) {
if (!isset($uid)) {
$uid = $GLOBALS['user']->uid;
}
$access = module_invoke_all('fivestar_access', $type, $id, $uid);
foreach ($access as $result) {
if ($result == TRUE) {
return TRUE;
}
if ($result === FALSE) {
return FALSE;
}
}
}