Activity Points

From SocialEngine

Jump to: navigation, search

How the plugin works

FAQ

API for easy extending

The plugin exposes easy API consisting of functions for easy adding/substructing/modifying users points


/*********************** MAIN "FINANCIAL" FUNCTIONS *********************/


*
* Get current points balance
*
* @param int $user_id user_id
* @return int Current balance
*
*
*

function userpoints_get_points($user_id);


*
* Try deducting amount to see if user has enough points (points are NOT deducted)
*
* @param int $user_id user_id
* @param int $amount amount
*
* @return bool Success or failure of points try deduction 
*
*

function userpoints_try_deduct($user_id, $amount);


*
* Deduct points
*
* @param int $user_id User_id
* @param int $amount Amount to process
* @param bool $allowNegativeCredit If to allow "overdraft" - negative credit
*
* @return bool Success or failure of points deduction
*
*

function userpoints_deduct($user_id, $amount, $allowNegativeCredit = false);


*
* Add points
*
* @param int $user_id user_id
* @param int $amount amount
* @param bool $update_totalearned If to increase "total earned points" counter 
* 
*

function userpoints_add($user_id, $amount, $update_totalearned = true);


*
* Set points
* 
* @param int $user_id user_id
* @param int $amount amount
*
* 
*

function userpoints_set($user_id, $amount);

Personal tools