You are here

function _advpoll_votesettings in Advanced Poll 6.3

3 calls to _advpoll_votesettings()
advpoll_voting_binary_form_submit in modes/binary.inc
Registers the vote as a key for this node using votingapi_set_vote().
advpoll_voting_ranking_form_submit in modes/ranking.inc
Implementation of the vote hook for the runoff module.
_advpoll_writeins_voting_form_submit in ./advpoll.module
Voting form submission logic specific to writeins. This has been abstracted away from includes in the modes directory.

File

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

Code

function _advpoll_votesettings($vote, $nid) {

  // These settings are established by the configuration form.
  // option 0 is default behavior, option 1 is poll availability via cookie
  // and option 2 is constant availability - user can vote again upon refresh
  $advpollSettings = variable_get('advpoll_settings', array());
  $votingMode = $advpollSettings['voting_mode'];
  if ($votingMode) {
    $vote['uid'] = 0;
    $vote['vote_source'] = time();
    if ($votingMode == 1) {
      $duration = !empty($advpollSettings['cookie_duration']) ? $advpollSettings['cookie_duration'] : 60;
      setcookie('advpollvote' . $nid, 'voted', time() + 60 * $duration);
    }
  }
  return $vote;
}