You are here

function userpoints_service_points in User Points 6

Same name and namespace in other branches
  1. 5.3 userpoints_service.module \userpoints_service_points()

Logout user

1 string reference to 'userpoints_service_points'
userpoints_service_service in ./userpoints_service.module
Implementation of hook_service().

File

./userpoints_service.module, line 98

Code

function userpoints_service_points($uid, $points, $tid = NULL, $event = 'userpoints service', $description = NULL) {
  if (!$uid) {
    return services_error(t('User ID parameter is required.'));
  }
  if (!$points) {
    return services_error(t('Points parameter must be a negative or positive number.'));
  }
  $params = array(
    'uid' => $uid,
    'points' => $points,
    'tid' => $tid,
    'event' => $event,
    'description' => $description,
    'display' => FALSE,
    'moderate' => FALSE,
  );
  $result = userpoints_userpointsapi($params);
  $return = new stdClass();
  if (!$result['status']) {
    $return->reason = $result['reason'];
    $return->status = FALSE;
  }
  else {
    $return->status = TRUE;
  }
  return $return;
}