You are here

function fivestar_validate_target in Fivestar 7.2

Same name and namespace in other branches
  1. 5 fivestar.module \fivestar_validate_target()
  2. 6.2 fivestar.module \fivestar_validate_target()
  3. 6 fivestar.module \fivestar_validate_target()

Check that an item being voted upon is a valid vote.

Parameters

$entity_type: Type of target.

$id: Identifier within the type.

$tag: The VotingAPI tag string.

$uid: The user trying to cast the vote.

Return value

bool

1 call to fivestar_validate_target()
_fivestar_cast_vote in ./fivestar.module
Internal function to handle vote casting, flood control, XSS, IP based voting, etc...

File

./fivestar.module, line 325

Code

function fivestar_validate_target($entity_type, $id, $tag, $uid = NULL) {
  if (!isset($uid)) {
    $uid = $GLOBALS['user']->uid;
  }
  $access = module_invoke_all('fivestar_access', $entity_type, $id, $tag, $uid);
  foreach ($access as $result) {
    if ($result == TRUE) {
      return TRUE;
    }
    if ($result === FALSE) {
      return FALSE;
    }
  }
}