function userpoints_get_current_points in User Points 5.3
Same name and namespace in other branches
- 5 userpoints.module \userpoints_get_current_points()
- 5.2 userpoints.module \userpoints_get_current_points()
- 6 userpoints.module \userpoints_get_current_points()
- 7.2 userpoints.module \userpoints_get_current_points()
- 7 userpoints.module \userpoints_get_current_points()
Parameters
uid: user id of the user to get or lose the points:
Return value
number of current points in that user's account
5 calls to userpoints_get_current_points()
- userpoints_my_userpoints in ./
userpoints.module - userpoints_service_get in ./
userpoints_service.module - Get the number of points
- userpoints_user in ./
userpoints.module - userpoints_userpointsapi in ./
userpoints.module - _userpoints_update_cache in ./
userpoints.module
File
- ./
userpoints.module, line 381
Code
function userpoints_get_current_points($uid = NULL, $tid = NULL) {
if (!$uid) {
global $user;
$uid = $user->uid;
}
if (!$tid) {
$tid = userpoints_get_default_tid();
}
elseif ($tid == 'all') {
return (int) db_result(db_query('SELECT SUM(points) FROM {userpoints} WHERE uid = %d', $uid));
}
return (int) db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d AND tid = %d', $uid, $tid));
}