function votingapi_current_user_identifier in Voting API 6.2
Same name and namespace in other branches
- 6 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_votes in ./
votingapi.module - Cast a vote on a particular piece of content.
File
- ./
votingapi.module, line 175 - A generalized voting API for Drupal.
Code
function votingapi_current_user_identifier() {
global $user;
$criteria = array(
'uid' => $user->uid,
);
if (!$user->uid) {
$criteria['vote_source'] = ip_address();
}
return $criteria;
}