You are here

function userpoints_get_max_points in User Points 5.3

Same name and namespace in other branches
  1. 6 userpoints.module \userpoints_get_max_points()
  2. 7.2 userpoints.module \userpoints_get_max_points()
  3. 7 userpoints.module \userpoints_get_max_points()

Parameters

uid: user id of the user to get or lose the points:

Return value

number of max points in that user's account

File

./userpoints.module, line 400

Code

function userpoints_get_max_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(max_points) FROM {userpoints} WHERE uid = %d', $uid));
  }
  return (int) db_result(db_query('SELECT max_points FROM {userpoints} WHERE uid = %d AND tid = %d', $uid, $tid));
}