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。