You are here

function advpoll_remove_voter in Advanced Poll 5

Same name and namespace in other branches
  1. 6.3 advpoll.admin.inc \advpoll_remove_voter()
  2. 6 advpoll.admin.inc \advpoll_remove_voter()
  3. 6.2 advpoll.admin.inc \advpoll_remove_voter()
  4. 7.3 includes/advpoll.pages.inc \advpoll_remove_voter()
  5. 7 includes/advpoll.pages.inc \advpoll_remove_voter()
  6. 7.2 includes/advpoll.pages.inc \advpoll_remove_voter()

Remove an individual voter from the electoral list.

1 string reference to 'advpoll_remove_voter'
advpoll_menu in ./advpoll.module
Implementation of hook_menu().

File

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

Code

function advpoll_remove_voter() {
  $nid = arg(1);
  $uid = arg(3);
  if ($uid && ($node = node_load($nid))) {
    $result = db_query('SELECT name FROM {users} WHERE uid = %d', $uid);
    if (db_num_rows($result) > 0) {
      $user = db_fetch_object($result);
      db_query('DELETE FROM {advpoll_electoral_list} WHERE nid = %d AND uid = %d', $nid, $uid);
      drupal_set_message(t('%user removed from the electoral list.', array(
        '%user' => $user->name,
      )));
    }
    else {
      drupal_set_message(t('No user found with a uid of %uid.', array(
        '%uid' => $uid,
      )));
    }
  }
  drupal_goto('node/' . $node->nid . '/electoral_list');
}