function poll_cancel
poll_cancel($form, &$form_state)
Submit callback for poll_cancel_form().
File
- modules/poll/poll.module, line 955
- Enables your site to capture votes on different topics in the form of multiple choice questions.
Code
function poll_cancel($form, &$form_state) { global $user; $node = node_load($form['#nid']); db_delete('poll_vote') ->condition('nid', $node->nid) ->condition($user->uid ? 'uid' : 'hostname', $user->uid ? $user->uid : ip_address()) ->execute(); // Subtract from the votes. db_update('poll_choice') ->expression('chvotes', 'chvotes - 1') ->condition('chid', $node->vote) ->execute(); unset($_SESSION['poll_vote'][$node->nid]); drupal_set_message(t('Your vote was cancelled.')); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!poll!poll.module/function/poll_cancel/7.x