Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

User Points Integration

6 years 7 months ago
Licenses:
JomSocial Active

Hello, we would like to integrate PayPlans into JomSocial to allow for User Points to be awarded based on different actions. I have followed this guide ( documentation.jomsocial.com/wiki/User_Points_System ) to configure user points, but cannot get it to work. Can we get some assistance in the configuration? There are no real examples provided on the page to give guidance on implementation.

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi Manny,

What is the action? May i know your code detail, please?

If possible I need your backend and FTP access thank you

6 years 7 months ago
Licenses:
JomSocial Active

Hello Dimas, thank you for the reply. We are essentially looking for a way to create Karma points for different actions in PayPlans. For example, when a user purchases a plan we would like the ability to award them x amount of points. The documentation on the site isn't very specific on where to add the code, so here's what we've done in testing.

Here is my jomsocial_rule.xml in the root of the com_payplans directory:

<?xml version="1.0" encoding="utf-8"?>
<jomsocial>
	<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
	<component>com_payplans</component>
	<rules>
		<rule>
			<name>Purchase a Plan</name>
			<description>Give points when a user purchases a plan.</description>
			<action_string>payplans.thanks</action_string>
			<publish>true</publish>
			<points>1</points>
			<access_level>1</access_level>
		</rule>
    </rules>
</jomsocial>

And here's what I have in com_payplans/views/invoice/view.html.php:
require_once( JPATH_ROOT .'/components/com_community/libraries/core.php' );
include_once(JPATH_ROOT .'/components/com_community/libraries/userpoints.php' );

function thanks()
	{
		$act = new stdClass();
		$act->cmd = 'payplans.thanks';
		$act->actor = $userid;
		
		$itemId = $this->getModel()->getId();
		if($itemId){
			$invoice = PayplansInvoice::getInstance($itemId);
			$user    = $invoice->getBuyer(PAYPLANS_INSTANCE_REQUIRE);
			$this->assign('invoice', $invoice);
			$this->assign('user', $user);
			$this->setTpl('complete');
			return true;
			
			$params = new CParameter('');
			$params->set( 'action', 'payplans.thanks');       
			
			if (CUserPoints::assignPoint('payplans.thanks')){
				CActivityStream::addActor($act, $params->toString() );
				}

		}

The idea is that when a user purchases a plan, and gets to the "Thank you" page, JomSocial recognizes this and awards points. I will send you the backend information in a PM.

6 years 7 months ago
Licenses:
JomSocial Active

Hello Dimas, I believe I got it working. I was approaching this the wrong way. I updated my code to the following, and I can now see the points awarded.

require_once( JPATH_ROOT .'/components/com_community/libraries/core.php' );
include_once(JPATH_ROOT .'/components/com_community/libraries/userpoints.php' );
CuserPoints::assignPoint('purchase.plan');

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

glad to know that :)

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW