Terra Posted November 4, 2016 Share Posted November 4, 2016 Hi everyone, I'm creating new homepage panels via an action hook, but I'm unsure how I can achieve this: 1. Check if client has unpaid invoices 2. If client has unpaid invoices, provide link to page with unpaid invoice(s) How can I get the client's invoice data in a hook? Do I need to run my own db query or is the data accessible to me in some form? Advice appreciated, Edith 0 Quote Link to comment Share on other sites More sharing options...
Terra Posted November 4, 2016 Author Share Posted November 4, 2016 ah think I've got it $client = Menu::context('client'); $invoiceSum = Capsule::table('tblinvoices') ->where([ ['userid', $client->id], ['status', 'Unpaid'], ])->count(); Okay, this should work! Edith 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 5, 2016 Share Posted November 5, 2016 isn't there already a default panel that does this? but your code is fine - there's also a limited $invoices array on the homepage, so that could have been another option - but querying the db is more flexible. 0 Quote Link to comment Share on other sites More sharing options...
Terra Posted November 5, 2016 Author Share Posted November 5, 2016 Hi Brian, Yes, just saw the existing panel so that's great, but the DB query will come in handy for other custom panels I'm writing. Thank you! 0 Quote Link to comment Share on other sites More sharing options...
Terra Posted November 7, 2016 Author Share Posted November 7, 2016 On a different note, the documentation on changing existing panels appears very poor. This has worked for me to change sort order & colour on the existing domain registration box: #We change the sort order and colour if (!is_null($homePagePanels->getChild('Register a New Domain'))) { $register = $homePagePanels->getChild('Register a New Domain'); $register->setOrder('300'); $register->setExtras(array( 'color' => 'magenta' )); } Hope this helps anyone else updating their homepanels! PS: Similar to the query raised here https://forum.whmcs.com/showthread.php?104951-Updating-default-panel-colors-on-client-area-homepage , but as the thread is over 180 days old, it can't be updated. 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 7, 2016 Share Posted November 7, 2016 On a different note, the documentation on changing existing panels appears very poor. PS: Similar to the query raised here https://forum.whmcs.com/showthread.php?104951-Updating-default-panel-colors-on-client-area-homepage , but as the thread is over 180 days old, it can't be updated. lol - that was when v6 had been launched with very poor documentation and we were all fumbling in the dark trying to figure out how things work... the documentation hasn't improved, but we know more now. don't forget that you don't have to stick with the 20+ panel colours defined by WHMCS - you can use your own... you just need to define it first in custom.css 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.