function advpoll_get_user_votes in Advanced Poll 7.3
Same name and namespace in other branches
- 7 includes/advpoll_voteapi.inc \advpoll_get_user_votes()
- 7.2 includes/advpoll_voteapi.inc \advpoll_get_user_votes()
Returns unique choice ids for a given node id and user id.
Parameters
$nid: The node ID of the poll to be examined for the current user.
Return value
array Unique choice IDs selected by the user.
3 calls to advpoll_get_user_votes()
- advpoll_display_borda_results in advpoll_ranking/
advpoll_ranking.module - Determines how to theme poll results based on settings in $data.
- advpoll_display_results in ./
advpoll.module - Determines how to theme poll results.
- advpoll_display_runoff_results in advpoll_ranking/
advpoll_ranking.module - Determines how to theme poll results for Instant Run-off.
File
- includes/
advpoll_voteapi.inc, line 435 - Advanced Poll Vote API Include.
Code
function advpoll_get_user_votes($nid) {
global $user;
$votes = array();
$criteria = array();
$criteria['entity_id'] = $nid;
$criteria['entity_type'] = 'node';
$criteria['value_type'] = 'percent';
$criteria['uid'] = $user->uid;
if (!$user->uid) {
$criteria['vote_source'] = ip_address();
}
$results = votingapi_select_votes($criteria);
if ($results) {
foreach ($results as $result) {
$votes[] = $result['tag'];
}
}
return $votes;
}