Voici le code modifié, mais attention, je n'ai pas testé...
////////////////////// START PLUGAUP MODIFICATION /////////////////
//// Start with parameters
//AUP point value default is 0.01 and stands for one cent if currency is USD or Euro for ex...<br />
$aupoint = 0.01; // As AUP doesn't care about decimals, we recommend setting the smallest unit the currency can handle
$naming = 0 // 0 for username , 1 for realname
if($naming==0) $naming = 'username';
elseif ($naming==1) $naming = 'name';
$profileman = 0 // 0 for Community Builder, 1 for Jomsocial
$profileitmeid = 10008 // Set here your own user profiles itemid
// if you want to reward the vendor user 90% of the sale
$paypcentage = 90; // here 90 goes to the vendor so finally only 10 to the site owner.
//I'm interested in what you think about this rate and what rate you use -> nordmograph.com forum ;)
// here we go
$q = "SELECT * FROM #__{vm}_product_download WHERE download_id = '$download_id'";
$db->query($q);
$db->next_record();
$aup_download_id = $db->f("download_id");
$aup_file_name = $db->f("file_name");
$aup_clientid = $db->f("user_id");
/// Here we get the naming of the customer:
$q="SELECT ".$naming." FROM #__users WHERE id='".$aup_clientid."'";
$db->query($q);
$clientnaming = $db->loadResult();
if($profileman==0)
$clientprofileurl=JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='.$aup_clientid.'&Itemid='.$profileitemid);
elseif($profileman==1) $clientprofileurl=JRoute::_('index.php?option=com_community&view=profile&userid='.$aup_clientid.'&Itemid='.$profileitemid);
// we get the first part of the sku from the file name which corresponds to the vendor userid
$aup_exploded = explode(".",$aup_file_name);
$aup_vendoruserid = $aup_exploded[0];
$aup_productid = $db->f("product_id");
// we get the shopper group of the customer to determine the price he paid the product
// so we don't reward too much the vendor if the customer had a special price from his shoppergroup
$q ="SELECT shopper_group_id FROM #__{vm}_shopper_vendor_xref WHERE user_id='$aup_clientid'";
$db->query($q);
$db->next_record();
$aup_shoppergroup = $db->f("shopper_group_id");
$q ="SELECT product_price FROM #__{vm}_product_price WHERE product_id='$aup_productid' AND shopper_group_id='$aup_shoppergroup'";
$db->query($q);
$db->next_record();
$aup_cprice = $db->f("product_price");
$aup_cprice= round($aup_cprice,2);
$aup_topay = $aup_cprice * $paypcentage / 100 / $aupoint;
////////////// Payment via AUP API//////////////////////
$informationdata = 'Downloaded File: '.$aup_file_name.'.<br />Customer: <a href="'.$clientprofileurl.'">'.$clientnaming.'</a> paid '.$aup_cprice.' and you got '.$paypcentage.'%';
$referencekey = 'Download ID: '.$aup_download_id;
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
$aupid = AlphaUserPointsHelper::getAnyUserReferreID( $aup_vendoruserid );
if ( $aupid ) AlphaUserPointsHelper::newpoints( 'plgaup_vm_payment2vendor', $aupid, $referencekey , $informationdata , $aup_topay );
}
////////////////////// END AUP API /////////////////
////////////////////// END MODIFICATION /////////////////
Dis moi si ça fonctionne
Par defaut ca affichele username
mais si tu changes le paremtre $naming pour 1 au debut du code, ça affichera le 'name'
Dis moi ce que ca donne. N'oublie pas de mettre le bon itemid aussi