vpsVPS口碑网

WHMCS 使用教程 - 如何将账户余额显示在客户中心页面

在/includes/hooks/下新建个PHP文件,名称可以任意取,例如credits.php
然后将下面代码复制粘贴进去保存即可

 <?php
    use WHMCSViewMenuItem as MenuItem;
 if (App::getCurrentFilename() == 'clientarea' && $_SESSION['uid']) {
 add_hook('ClientAreaPrimarySidebar', 10, function(MenuItem $primarySidebar) { 
$client = getClientsDetails(); 
if($client) { 
$newMenu = $primarySidebar->addChild( 
'account-info', 
array( 
'name' => 'Home', 
'label' => '账户详情', 
'order' => 10, 
'icon' => 'fa-balance-scale', 
) 
); 
$newMenu->addChild( 
'account_balance', 
array( 'name' => 'account_balance', 
'label' => "账户余额: ".formatCurrency($client['credit']), 
'order' => 0, 
) 
); 
} 
}); 
} 

add_hook('ClientAreaFooterOutput', 1, function($vars) 
{ 
$command = "getclientsdetails"; 
$adminuser = "您的管理员用户名"; 
$values["clientid"] = $_SESSION['uid']; 
$results = localAPI($command,$values,$adminuser); 
if($_SESSION['uid']) { 
$footer_return = ' 
ipt>jQuery(document).ready(function() { 
$($(".pull-right.nav")[1]).after(' 余额:¥'.$results['credit'].'RMB') })';
return $footer_return; 
} 
} 
);

 

郑重声明:本站部分文章来自网络,如有侵权请联系站长。【加入VPS口碑QQ群聊

宝塔