function advpoll_cancel_vote_submit in Advanced Poll 7.3
Same name and namespace in other branches
- 7 advpoll.module \advpoll_cancel_vote_submit()
- 7.2 advpoll.module \advpoll_cancel_vote_submit()
Submit function for cancelling a vote.
1 string reference to 'advpoll_cancel_vote_submit'
- advpoll_cancel_vote_form in ./
advpoll.module - Form element for canceling votes.
File
- ./
advpoll.module, line 847
Code
function advpoll_cancel_vote_submit($form, &$form_state) {
global $user;
$nid = $form['#nid'];
$criteria = array();
$criteria['entity_id'] = $nid;
$criteria['entity_type'] = 'node';
$criteria['uid'] = $user->uid;
if (!$user->uid) {
$criteria['vote_source'] = ip_address();
}
votingapi_delete_votes(votingapi_select_votes($criteria));
$node = node_load($nid);
if (advpoll_user_eligibility($node)) {
// print out voting form
$update_form = drupal_get_form('advpoll_choice_form', $node);
return drupal_render($update_form);
}
}