H1kari Posted September 30, 2021 Share Posted September 30, 2021 Hello, I wanna change ClientAreaHomePagePanels in custom hook by using $productGroupId. For example, if our clients have 'ACTIVE' products with $productGroupId = '1', we show them homePagePanel number one. If our clients have 'ACTIVE' products with $productGroupId = '2', we show them homePagePanel number two. If our clients don't have 'ACTIVE' products, than show nothing. My code, but something is wrong: <?php use WHMCS\View\Menu\Item; use WHMCS\Service\Service; add_hook('ClientAreaHomepagePanels', 1, function (Item $homePagePanels) { $service = Menu::context('service'); $gid = $service->product->productGroupId; $activeorders = $client->orders->where('status','Active')->count(); if ($client && $activeorders > 0) { if ($gid == '1') { $gettingStartedMessage = <<<EOT <p>If you are new here and would like help getting started, here is some resources you might find helpf$ <center> <a href="url" class="btn btn-default btn-sm">Installation Guide</a> <a href="url" class="btn btn-default btn-sm">Importing Your Data</a> <a href="url" class="btn btn-default btn-sm">Licensing FAQ</a> </center> </p> EOT; } if ($gid == '2') { $gettingStartedMessage = <<<EOT <p> If you are new here and would like help getting started, here is some resources you might find help$ <center> <a href="url" class="btn btn-default btn-sm">Installation Guide</a> <a href="url" class="btn btn-default btn-sm">Importing Your Data</a> </center> </p> EOT; } if ($gid == '3') { $gettingStartedMessage = <<<EOT <p> If you are new here and would like help getting started, here is some resources you might find help$ <center> <a href="url" class="btn btn-default btn-sm">Installation Guide</a> </center> </p> EOT; } $supportTeam = <<< EOT <center> <p>Need help? <a href="submitticket.php">Contact our support team</a></p> </center> EOT; $homePagePanels->addChild('GettingStarted', array( 'label' => 'Getting Started Guide', 'icon' => 'fa-thumbs-up', 'order' => 999, 'extras' => array( 'color' => 'orange' ), 'bodyHtml' => $gettingStartedMessage, 'footerHtml' => $supportTeam )); }}); 0 Quote Link to comment Share on other sites More sharing options...
H1kari Posted September 30, 2021 Author Share Posted September 30, 2021 need to add $client = Menu::context('client'); $clientid = $client->id; 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.