You are here

function advpoll_ranking_cancel_submit in Advanced Poll 7

Same name and namespace in other branches
  1. 7.2 advpoll_ranking/advpoll_ranking.module \advpoll_ranking_cancel_submit()
1 string reference to 'advpoll_ranking_cancel_submit'
advpoll_ranking_cancel_form in advpoll_ranking/advpoll_ranking.module

File

advpoll_ranking/advpoll_ranking.module, line 666

Code

function advpoll_ranking_cancel_submit($form, &$form_state) {
  global $user;
  if ($user) {
    $nid = $form['#nid'];
    $criteria = array();
    $criteria['entity_id'] = $nid;
    $criteria['entity_type'] = 'advpoll';
    $criteria['uid'] = $user->uid;
    votingapi_delete_votes(votingapi_select_votes($criteria));
    $node = node_load($nid);
    if (advpoll_user_eligibility($node)) {

      // print out voting form
      return '<div class="advpoll-ranking-wrapper">' . drupal_render(drupal_get_form('advpoll_ranking_choice_form', $node)) . '</div>';
    }
  }
}