You are here

function advpoll_form_submit_check in Advanced Poll 7

Same name and namespace in other branches
  1. 7.3 advpoll.module \advpoll_form_submit_check()
  2. 7.2 advpoll.module \advpoll_form_submit_check()
2 calls to advpoll_form_submit_check()
advpoll_form_submit in ./advpoll.module
Submit handler for voting
advpoll_ranking_submit in advpoll_ranking/advpoll_ranking.module

File

./advpoll.module, line 661

Code

function advpoll_form_submit_check($data, $nid) {
  if ($data->mode === 'cookie' && isset($_COOKIE['advpoll' . $nid])) {
    return t('You have already voted on this poll.');
  }
  if ($data->mode === 'normal') {
    global $user;
    $criteria = array();
    $criteria['entity_id'] = $nid;
    $criteria['entity_type'] = 'advpoll';
    $criteria['uid'] = $user->uid;
    $results = votingapi_select_votes($criteria);
    if ($results) {
      return t('You have already voted on this poll.');
    }
  }
  return;
}