By Anthony on Wednesday, 20 January 2016
Likes 0
Views 1K
Votes 0
EDITED VERSION

If you are wondering if you can assign points from an external PHP script, the answer is yes. Here is how I did it without creating an app.

First I went in Administrator->Components->EasySocial->User Points -> Install and added the following rule file (apps2.points). Code shown below.

[
{
"title" : "Add Quiz Points",
"alias" : "add-points",
"description" : "Test if I can award points from an external PHP script.",
"command" : "apps.addpoints",
"extension" : "com_easysocial",
"state" : true,
"points" : 5
},
{
"title" : "Remove Quiz Points",
"alias" : "remove-points",
"description" : "Test if I can remove points from an external PHP script.",
"command" : "apps.removepoints",
"extension" : "com_easysocial",
"state" : true,
"points" : -5
}
]


I checked to make sure that the rule was published in EasySocial then I created an external script called easysocialpoints.php (code shown below).

<?php

/**
* Include EasySocial
*/
require_once( JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php' );
Foundry::points()->assign( 'apps.addpoints' , 'com_easysocial' , $userID );
//You will need to include Joomla at the top of this script and you will need to get the value of the logged in user-otherwise this script will not work
?>


Once I ran the code by visiting mywebsite/easysocialpoints.php I checked the profile for the current user and saw that the points had been successfully awarded.

Unfortunately, I'm still not sure how to assign variable points without creating a rule for each different amount that I want to award- not cool.


REFERENCES
http://stackideas.com/docs/easysocial/developers/applications/getting-started
http://stackideas.com/docs/easysocial/developers/points/rule-file
http://stackideas.com/docs/easysocial/developers/points/logging
hey there,

I am very sorry for delayed of this reply, it seems like our system didn't pick up your post show on forums

By the way, If you still have any other issue you can start a new thread from our forums, we will assist you on it.
·
Tuesday, 11 October 2016 12:57
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post