是否有任何插件或黑客可以让我使用 alphauserpoints 积分来支付 joomla 中的 adsmanager 广告的费用?
问问题
880 次
1 回答
0
这是我针对 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($userid)。这是在 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。
于 2012-07-19T13:50:43.477 回答