How can I add points directly to the User Points database? I have a quiz site and would like to use the User Points module to store quiz scores, instead of creating something from scratch. I have created a taxonomy "Quiz" for such points.
Every quiz ends by showing the score made (between 0 to 100 depending on how many answers they got right). I would like to go on and store this in the userpoint database.
I am using the following code but m getting 2 error messages:
Notice: Undefined variable: user in ...
Notice: Trying to get property of non-object in ....
The code I am using is the following one:
$params = array ( 'uid' => $user->uid, 'description' => 'Totals points from quizes', 'points' => $percentage, 'tid' =>127, ); userpoints_userpointsapi($params);