unknownsolo Posted March 9, 2021 Share Posted March 9, 2021 Hi all, pre WHMCS 8.0, we used to be able to pull all the invoices on clientareahome.tpl but it looks like this is no longer the case, $invoices is not automatically generated on that page anymore. Can someone please help with getting that back with a hook? something like the below for products but for invoices? PS. code below was taken from the awesome @brian! <?php use Illuminate\Database\Capsule\Manager as Capsule; function products_list_hook($vars) { $client = Menu::context('client'); $services = Capsule::table('tblhosting') ->join('tblproducts','tblhosting.packageid','=','tblproducts.id') ->where('userid',$client->id) ->select('tblhosting.*','tblproducts.name as product') ->get(); $encodedata = json_encode($services); $decodedata = json_decode($encodedata, true); return array("services" => $decodedata); } add_hook("ClientAreaPageHome", 1, "products_list_hook"); ?> 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 9, 2021 Share Posted March 9, 2021 2 hours ago, unknownsolo said: pre WHMCS 8.0, we used to be able to pull all the invoices on clientareahome.tpl but it looks like this is no longer the case, $invoices is not automatically generated on that page anymore. assuming the reason you need the $invoices array is because you have an invoices table on clientareahome, then the quick solution would be.. <?php # Client Invoices on Homepage Hook # Written by brian! function clients_invoices_on_homepage_hook($vars) { $invoice = new WHMCS\Invoice(); $client = Menu::context('client'); $invoices = $invoice->getInvoices("Unpaid",$client->id,"id","DESC"); return array("invoices" => $invoices); } add_hook("ClientAreaPageHome", 1, "clients_invoices_on_homepage_hook"); there would be alternative ways to create the array, but I think the above method will be the simplest one to give you back what you previously had. 0 Quote Link to comment Share on other sites More sharing options...
unknownsolo Posted March 9, 2021 Author Share Posted March 9, 2021 That did it! As always, thank you so much, brian! 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.