You are here

function advpoll_eligible in Advanced Poll 6

Same name and namespace in other branches
  1. 5 advpoll.module \advpoll_eligible()
  2. 6.3 advpoll.module \advpoll_eligible()
  3. 6.2 advpoll.module \advpoll_eligible()

Check if user is eligible to vote in this poll.

4 calls to advpoll_eligible()
advpoll_voting_binary_form in modes/binary.inc
Implementation of the view_voting hook for the poll module.
advpoll_voting_binary_form_validate in modes/binary.inc
Check if the submitted key exists, just to make sure the form is not bypassed.
advpoll_voting_ranking_form in modes/ranking.inc
advpoll_voting_ranking_form_validate in modes/ranking.inc
Implementation of the vote validation hook for the runoff module.

File

./advpoll.module, line 1297
Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.

Code

function advpoll_eligible($node, $uid = NULL) {
  global $user;
  if (!isset($uid)) {
    $uid = $user->uid;
  }
  if ($node->use_list) {
    $eligible = db_result(db_query('SELECT COUNT(*) FROM {advpoll_electoral_list} WHERE nid = %d AND uid = %d', $node->nid, $uid));
  }
  else {
    $eligible = user_access('vote on polls');
  }
  return $eligible;
}