Howdy everyone. Got a quick update and some code to test! We got AUP installed and played around with a bit. Pretty slick extension overall, I must say. Originally, we were thinking we had to create the XML rule files to distribute. After installing AUP though, we realized we could simply create the Rules through the admin area. For now, that's what we're going to recommend during this testing stage.
So.. on with it. To reward an inviter for sending a Request, do the following:
Create a new Rule in AUP
* Go to the AUP admin area, click Rules, click "New"
* Select the Category - Recommend / Invite sounds best, but is your choice.
* Rule Name - "Facebook Request" - again, whatever you want
* Plugin Type - JFBConnect
* Unique function name - plgjfbconnect_request_sent (exactly)
* Points - Amount of points to award per user invited. (If a user opens up the dialog and invites 50 people, they will get this point value 50 times)
* Fixed Points - Yes
* Method - Whenever
Update JFBConnect to Award Points
Then, open the /components/com_jfbconnect/controllers/request.php file. Around line 38, you'll see:
$data['created'] = JFactory::getDate()->toMySQL();
$data['modified'] = null;
After that, add:
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
$aupInstalled = true;
}
else
$aupInstalled = false;
Then, further down (around line 54, after the code above is added), you'll see:
Add the following after that:
if ($aupInstalled)
AlphaUserPointsHelper::newpoints( 'plgjfbconnect_request_sent', '', $fbTo);
When done, the user should get the points specified from the rule whenever they invite a friend. They will only be awarded the points for each unique friend they invite. Inviting the same friend repeatedly should not award points.
Again, this is new to us, but we've been pleasantly surprised with how easy it was to implement. We'll be looking for feedback or improvements for flexibility to suite different usage cases. If there are other areas you'd like to award points now, let us know. It should be pretty easy to add points all over the place from here on out
Thanks for your patience, and good luck!
Alex