I am trying to add an AUP transaction from the results of a Fabrik form the user fills out; what I want to do is when the form posts, have the number of points the user fills in subtracted from his total AUP points. The process seems pretty straightforward. You insert the code for the AUP API, then create an XML file with your new rule (redeem_points), it should work:
// Get the user's input from the Fabrik field and put it in a variable, $debit //
$userid = $user->get('id');
SELECT `points` FROM `jos_alpha___userpoints` WHERE `id` = $userid;
$numPoints = $database->loadResult();
$debit = $formModel->_formData('jos_redeem_rewards_points___pointsrede emed');
//AUP API code //
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints '.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints('plgaup_redeem_points', -$debit);
}
But when the form posts, nothing is inserted on the user's points transactions AUP db table...
There is a considerable amount of info on doing this - you have to drill down into the Google results to find it - but no one has really explained the entire procedure well, I think. Not much action on the AUP board, either.
// Get the user's input from the Fabrik field and put it in a variable, $debit //
$userid = $user->get('id');
SELECT `points` FROM `jos_alpha___userpoints` WHERE `id` = $userid;
$numPoints = $database->loadResult();
$debit = $formModel->_formData('jos_redeem_rewards_points___pointsrede emed');
//AUP API code //
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints '.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints('plgaup_redeem_points', -$debit);
}
But when the form posts, nothing is inserted on the user's points transactions AUP db table...
There is a considerable amount of info on doing this - you have to drill down into the Google results to find it - but no one has really explained the entire procedure well, I think. Not much action on the AUP board, either.