0
有没有任何插件或黑客让我使用alphauserpoints积分来支付joomla中的adsmanager广告费用?如何在joomla中使用alphauserpoints积分对adsmanager付款?
有没有任何插件或黑客让我使用alphauserpoints积分来支付joomla中的adsmanager广告费用?如何在joomla中使用alphauserpoints积分对adsmanager付款?
这里是我对Alphauserpoints 1.7.4,Adsmanager 2.7 RC3和PaidSystem的解决方案。
编辑components\com_paidsystem\api.paidsystem.php
defined('_JEXEC') or die('Restricted access');
后添加下面的代码
//AlphaUserPoints start
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if (file_exists($api_AUP))
{
require_once ($api_AUP);
}
//AlphaUserPoints end
接下来你需要编辑功能为getBalance($用户ID)。这是api.paidsystem.php
function getBalance($userid)
{
//Alphauserpoints substitute for value
//Get the RefferreID of a user
$referreid = AlphaUserPointsHelper::getAnyUserReferreID((int)$userid);
$profil=AlphaUserPointsHelper:: getUserInfo ($referreid);
$value=$profil->points;
//Alphauserpoints substitute for value end
//ORIGINAL CODE BELOW
/*$db =JFactory::getDbo();
//$db->setQuery("SELECT credit FROM #__paidsystem_credits WHERE userid=".(int)$userid);
//To explicitly convert a value to integer, use either the (int) or (integer) casts.
$value = $db->loadResult();*/
if ($value == "")
$value = 0;
return $value;
}
然后编辑一个功能
//EDIT this to debit credits from alphauserpoints
//Use alphauserpoints rule to debit from alphauserpoints.
function removeCredits($userid,$num,$description)
{
$db =JFactory::getDbo();
//$db->setQuery("SELECT credit FROM #__paidsystem_credits WHERE userid=".(int)$userid);
//$balance = (float) $db->loadResult();
$referreid = AlphaUserPointsHelper::getAnyUserReferreID((int)$userid);
$profil=AlphaUserPointsHelper:: getUserInfo ($referreid);
$balance=$profil->points;
//$db->setQuery("UPDATE #__paidsystem_credits SET credit=credit-".(float)$num." WHERE userid=".(int)$userid);
//$db->query();
echo "removeCredits=$userid,$num";
$obj = new stdClass();
$obj->userid = $userid;
$obj->balance = $balance;
$obj->change = $num * -1;
$obj->description = $description;
$obj->date = date("Y-m-d H:i:s");
AlphaUserPointsHelper::newpoints('plgaup_purchaseadvertising', '','', 'purchase advertising', $num*-1);
$db->insertObject("#__paidsystem_history",$obj);
}
记住:您需要在的Joomla的alphauserpoints组件的管理员部分可以创建新规则这工作。在我的代码中,新的规则名称被称为plgaup_purchaseadvertising。