function advpoll_remove_voter in Advanced Poll 6.2
Same name and namespace in other branches
- 5 advpoll.module \advpoll_remove_voter()
- 6.3 advpoll.admin.inc \advpoll_remove_voter()
- 6 advpoll.admin.inc \advpoll_remove_voter()
- 7.3 includes/advpoll.pages.inc \advpoll_remove_voter()
- 7 includes/advpoll.pages.inc \advpoll_remove_voter()
- 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.admin.inc, line 11 - Page callbacks for the advpoll module.
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 ($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');
}