Hey Tuan!
I want to thank you for the custom plugin example you gave me last time!
I still cant get it to work, can you check my code?
Code:
<?php
/**
* @version 1.0.0
* @package Joomla
* @subpackage OS Membership Plugins
* @author Tuan Pham Ngoc
* @copyright Copyright (C) 2012-2014 Ossolution Team
* @license GNU/GPL, see LICENSE.php
*/
define( '_JEXEC', 1 );
define( 'JPATH_BASE', dirname(__FILE__) );
define( 'DS', '/' );
defined( '_JEXEC' ) or die ;
$hits = 5000;
$channelName = '';
$user = JFactory::getUser();
$user_file = $user->username . '.ini';
$hits_dir = JPATH_BASE . DS . "hits/";
class plgOSMembershipScript extends JPlugin
{
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Run when a subscription record stored into database (before payment is processed)
* @param PlanOsMembership $row
*/
function onAfterStoreSubscription($row)
{
//Put the code you want to run after the subscription record is stored in database
}
/**
* Run when a membership activated
* @param PlanOsMembership $row
*/
function onMembershipActive($row)
{
if(file_exists($hits_dir.$user_file)) {
$hits_ini = parse_ini_file($hits_dir.$user_file);
}
if(isset($hits_ini)) {
$hits += $hits_ini['hits'];
$channelName = $hits_ini['channel'];
}
$data = "[Configuration file]\r\n";
$data .= "hits=" . $hits . "\r\n";
$data .= "channel=" . $channelName;
file_put_contents($hits_dir.$user_file, $data, LOCK_EX);
}
}
This little code writes a configuration file with the joomla user name.
How can i implent this so it doesnt use this plugin on every subscription plan
Like the usergroup plugin, its only used on that subscription if you actually make a selection.
PS :
$amount = 5000
I hope you can help me out, if it does i can open my site and buy the payment plugins!