0

I found this snippet of code and I've managed to include this in my "handle posts" code so I expect to see points added to my profile each time a "add a trail".

    include_once JPATH_ROOT . '/components/com_community/libraries/core.php';
    include_once JPATH_ROOT . '/components/com_community/libraries/userpoints.php';
    CuserPoints::assignPoint('trail.add');

Anyone have any idea why this isn't working?

  • What do you mean by "isn't working"? – Lodder Oct 23 '16 at 0:00
  • I included this code and it does not throw any exceptions, however I am not seeing points get added to my profile. The points system works inside of JomSocial when I upload an image to the community, but not when I try to add points externally using this code. – dawoodman71 Oct 23 '16 at 23:41
1

After some research I found this PDF: https://www.joomlapolis.com/media/kunena/attachments/557850/developer_documentation_2.0.x_english.pdf

I found that using AlphaUserPointsHelper was the way to go.

// get AlphaUserPointsHelper
$api_AUP = JPATH_BASE . DS . 'components' . DS . 'com_alphauserpoints' . DS .'helper.php';
if (file_exists($api_AUP)) {
   require_once ($api_AUP);
   $user = JFactory::getUser();
   $referrerId = AlphaUserPointsHelper::getReferreid($user->id);
   AlphaUserPointsHelper::newPoints('custom.function.name', $referrerId);
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.