Change record status: 
Project: 
Introduced in branch: 
7.x-2.x
Description: 

userpoints_userpointsapi() as been replaced with a new function called userpoints_grant_points(). The function has two required arguments, first the operation to identify the type of the transaction and the amount of points ( can be positive or negative, just like before). The optional third argument is the user id, which defaults to the current user.

The function will then return a UserpointsTransaction instance which provides a number of methods to add additional information to this transaction, like the related entity, status and so on. See the linked documentation page for a detailed overview of all available methods.

Two examples, copied from the documentation from the linked userpoints_grant_points() documentation:

// Adding points to the current user, relying on automatic saving.
userpoints_grant_points('mymodule_type_action', $points);

// Grant points to another, add a entity reference to a node and save
// explicitly.
userpoints_grant_points('mymodule_type_otheraction', $points, $account->uid)
  ->setEntity($node)
  ->save();
Impacts: 
Site builders, administrators, editors
Module developers