brian! Posted February 12, 2016 Share Posted February 12, 2016 How do I get it to show the credit balance only in the billing section? you could modify the hook code and change... $filename = APP::getCurrentFileName(); $client = Menu::context("client"); $clientid = (int) $client->id; if ($filename!=='clientarea' || $clientid===0){ return; } to... $filename = APP::getCurrentFileName(); $action = $_GET['action']; $allowed = array('invoices', 'quotes', 'masspay', 'addfunds'); $client = Menu::context("client"); $clientid = (int) $client->id; if ($filename!=='clientarea' || $clientid===0 || !in_array($action,$allowed)){ return; } if you do this, then the credit balance sidebar will only show on the invoice, quotes, masspay and addfunds pages. 2 Quote Link to comment Share on other sites More sharing options...
rkatz0 Posted February 12, 2016 Share Posted February 12, 2016 (edited) you could modify the hook code and change... if you do this, then the credit balance sidebar will only show on the invoice, quotes, masspay and addfunds pages. Oh excellent, thanks so much! Is that how that is done, great! Obviously I haven't spent much time coding in the WHMCS environment. I was also able to put a conditional for the credit balance so it only shows if the balance is above zero! If anyone needs that my final is this, the balance also shows on the main/home page as well but not on non billing related pages: add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $primarySidebar){ $filename = APP::getCurrentFileName(); $client = Menu::context("client"); $clientid = (int) $client->id; $action = $_GET['action']; $allowed = array('invoices', 'quotes', 'masspay', 'addfunds',''); if ($filename!=='clientarea' || $clientid===0 || !in_array($action,$allowed)){ return; } if ($client->credit <= 0.00) { return; } Thanks again brian! !!! Edited February 12, 2016 by rkatz0 1 Quote Link to comment Share on other sites More sharing options...
sentq Posted February 12, 2016 Author Share Posted February 12, 2016 @brian nice job 0 Quote Link to comment Share on other sites More sharing options...
phillmobile Posted April 27, 2016 Share Posted April 27, 2016 Hi this is my first post and a big thanks this is just what i was looking for. Phill 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted April 27, 2016 Author Share Posted April 27, 2016 Hi this is my first post and a big thanks this is just what i was looking for. Phill Phill, you're welcome 0 Quote Link to comment Share on other sites More sharing options...
bangzafran Posted May 19, 2016 Share Posted May 19, 2016 I need this, thankyou so much 1 Quote Link to comment Share on other sites More sharing options...
ThemeMetro Posted July 12, 2016 Share Posted July 12, 2016 For this issue permanent solution is http://forums.whmcs.com/showthread.php?114126-Six-template-Small-Layout-Issue-Fix&p=462390#post462390 Thank you! hook works insanely well... Found one issue, when in "Portal Home / Client Area / My Invoices" the Secondary_Sidebar-Billing module glitches out from the sidebar. Sorry not very familiar, learning whmcs as I go along. (See screenshot) Is there an easy fix to this? Thanks in advance... Once again Great Hook!!! [ATTACH=CONFIG]9667[/ATTACH] 0 Quote Link to comment Share on other sites More sharing options...
MikeDVB Posted July 18, 2016 Share Posted July 18, 2016 Just for those wanting this module with the last modification without having to sort out the modification I've attached a copy. I didn't code this or change it beyond including the modifications found in this thread already. I.e. I will not provide support . WHMCS_SixTemplateCreditBalance.php.zip 1 Quote Link to comment Share on other sites More sharing options...
sentq Posted July 18, 2016 Author Share Posted July 18, 2016 Just for those wanting this module with the last modification without having to sort out the modification I've attached a copy. I didn't code this or change it beyond including the modifications found in this thread already. I.e. I will not provide support . it will be displayed in the following pages only if client already has credit: Home Page - My Invoices - My Quotes - Mass Payment - Add Funds @MikeDVB thanks for sharing 0 Quote Link to comment Share on other sites More sharing options...
Giannis Posted January 13, 2017 Share Posted January 13, 2017 Thank you looks nice i will try it. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted January 30, 2017 Author Share Posted January 30, 2017 @Giannis, you welcome Here is how to implement it as Client Portal Panel: https://forum.whmcs.com/showthread.php?124790-Adding-a-quot-Credit-Balance-quot-panel-to-the-client-area-home-page&p=500630#post500630 0 Quote Link to comment Share on other sites More sharing options...
zillionet Posted April 18, 2017 Share Posted April 18, 2017 Just wanted to jump in and give you a big Thank you for this lil module. Works perfectly for my needs! 1 Quote Link to comment Share on other sites More sharing options...
itoverblik Posted May 9, 2017 Share Posted May 9, 2017 Hi, I am not able to download the ZIP file, keeps saying I have to login, even though I am logged in already, strange!? Strange, now it worked Just what I was searching for, thx a lot. 0 Quote Link to comment Share on other sites More sharing options...
cliXtar Posted June 14, 2017 Share Posted June 14, 2017 Hello, I just want to fix the bug that when someone try to verify his email address when he's already logged in, he gets the balance in the login page. ... if ($filename!=='clientarea' || $clientid===0 || strpos($_SERVER['REQUEST_URI'], 'verificationId') !== false) { return; } ... Regards, 0 Quote Link to comment Share on other sites More sharing options...
olus Posted July 15, 2017 Share Posted July 15, 2017 Easy peasy! Done in a minute! Thank you very much for this solution! 0 Quote Link to comment Share on other sites More sharing options...
natanet Posted July 19, 2017 Share Posted July 19, 2017 many thanks for this.. we need that 0 Quote Link to comment Share on other sites More sharing options...
Guest Posted August 7, 2017 Share Posted August 7, 2017 Superb, I was looking exactly for this. Thank you for your efforts 0 Quote Link to comment Share on other sites More sharing options...
jamespierre Posted August 30, 2017 Share Posted August 30, 2017 Hola, solo genial que tambien muestre en Inicio, tenga o no crédito el cliente. 0 Quote Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2017 Share Posted September 19, 2017 This is great, really! Thank you for adding it. However there is a problem on my installation where the "Actions" block are not aligned with the other blocks on the left side. Instead, it goes to the contents area. This happens for example when we open the EPP code page, but not all pages. Please see the screenshot: http://dns.d.pr/opM4Ex/ao4i5Lg9 Is there a way to fix this? Thank you 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 19, 2017 Author Share Posted September 19, 2017 This is great, really! Thank you for adding it. However there is a problem on my installation where the "Actions" block are not aligned with the other blocks on the left side. Instead, it goes to the contents area. This happens for example when we open the EPP code page, but not all pages. Please see the screenshot: http://dns.d.pr/opM4Ex/ao4i5Lg9 Is there a way to fix this? Thank you Hi, Thank you the issue is common with Template Six, here is the way to fix it: https://forum.whmcs.com/showthread.php?106891-Display-Credit-Balance-In-Six-Template&p=448314#post448314 0 Quote Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2017 Share Posted September 19, 2017 Hi, Thank you the issue is common with Template Six, here is the way to fix it: https://forum.whmcs.com/showthread.php?106891-Display-Credit-Balance-In-Six-Template&p=448314#post448314 Superb, it worked Now, my store does not allow customers to Add Funds but the button to add funds is visible. Is it possible to remove the button and just display the existing credit (i.e. from refunds or manually added by us)? A php condition would be great, in case we enable the add funds in the future. Thank you once again. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 19, 2017 Share Posted September 19, 2017 Now, my store does not allow customers to Add Funds but the button to add funds is visible. Is it possible to remove the button and just display the existing credit (i.e. from refunds or manually added by us)? to remove it permanently, just remove the footer code from the hook... $balancePanel->setFooterHtml( '<a href="clientarea.php?action=addfunds" class="btn btn-success btn-sm btn-block"> <i class="fa fa-plus"></i> '.Lang::trans('Add Funds').' </a>' ); A php condition would be great, in case we enable the add funds in the future. to make the footer conditional on the add funds feature being enabled, just wrap it in an if statement - there'd be a few ways to do that, checking the $CONFIG array would be the simplest, but as sentq is already using Capsule, we'll go down that route... $fundsenabled = Capsule::table('tblconfiguration')->where('setting','AddFundsEnabled')->value('value'); if ($fundsenabled == "on") { $balancePanel->setFooterHtml( '<a href="clientarea.php?action=addfunds" class="btn btn-success btn-sm btn-block"> <i class="fa fa-plus"></i> '.Lang::trans('Add Funds').'</a>' ); } if using WHMCS v6, you may need to change ->value('value') to ->pluck('value'). 0 Quote Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2017 Share Posted September 19, 2017 Just tried the conditional version, worked perfectly fine The only thing missing is the link that it is still active on the "Available Credit" box but it is not a big problem for me. It is ok as it is. Thank you for all your help and extremely fast prompt. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 19, 2017 Share Posted September 19, 2017 Just tried the conditional version, worked perfectly fine The only thing missing is the link that it is still active on the "Available Credit" box but it is not a big problem for me. It is ok as it is. you could remove the code below and that would remove the link... 'uri' => 'clientarea.php?action=addfunds', if add funds is enabled, then the client can use the button link in the footer... if it's not enabled, the above link is irrelevant! 0 Quote Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2017 Share Posted September 19, 2017 Yeap, it worked Thanks brian! Just in case someone needs the full code ready, here it is: https://gist.github.com/sitesme/fcd65e214e0eccc88fe160b52c8a3f8e 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.