function votingapi_current_user_identifier in Voting API 6
Same name and namespace in other branches
- 6.2 votingapi.module \votingapi_current_user_identifier()
- 7.2 votingapi.module \votingapi_current_user_identifier()
Generate a proper identifier for the current user: if they have an account, return their UID. Otherwise, return their IP address.
1 call to votingapi_current_user_identifier()
- votingapi_set_vote in ./
votingapi.module - Cast a vote on a particular piece of content. If a vote already exists, its value is changed. In most cases, this is the function that should be used by external modules.
File
- ./
votingapi.module, line 167
Code
function votingapi_current_user_identifier() {
global $user;
$criteria = array();
if ($user->uid) {
$criteria['uid'] = $user->uid;
}
else {
$criteria['vote_source'] = ip_address();
}
return $criteria;
}