Vike Posted June 4, 2019 Share Posted June 4, 2019 Hello, I made a clietarea secondary sidebar using the following hook that only slows on the clientarea 'My Dahsboard' section use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { $client = Menu::context('client'); if($client){ $secondarySidebar->addChild('Resources') ->setUri('https://www.example.com/') ->setOrder(15); } }); add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Resources'))) { $secondarySidebar->getChild('Resources') ->addChild('coming-soon') ->setLabel('Coming Soon...') ->setUri('clientarea.php') ->setOrder(100); } }); But now having turned on WHMCS Email Verification - the sidebar shows on the stage where the user is required to enter their email and password while they are still logged into the clientarea. Is there a way to tell the hook to only show on the dashboard page? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2019 Share Posted June 5, 2019 On 04/06/2019 at 08:24, mikejarvisnicol said: Hello, I made a clietarea secondary sidebar using the following hook that only slows on the clientarea 'My Dahsboard' section as written, it should show on every page in the client area once they're logged in... On 04/06/2019 at 08:24, mikejarvisnicol said: But now having turned on WHMCS Email Verification - the sidebar shows on the stage where the user is required to enter their email and password while they are still logged into the clientarea. Is there a way to tell the hook to only show on the dashboard page? you could specify which templates/pages to show the sidebar on - e.g the hook below will only display your sidebar on the client's homepage - which i'm assuming is your dashboard page. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { GLOBAL $smarty; $client = Menu::context('client'); $templatefile = $smarty->getTemplateVars()['templatefile']; if($client && $templatefile === 'clientareahome'){ $secondarySidebar->addChild('Resources')->setOrder(15)->addChild('coming-soon')->setLabel('Coming Soon...')->setUri('clientarea.php'); } }); 1 Quote Link to comment Share on other sites More sharing options...
Vike Posted June 5, 2019 Author Share Posted June 5, 2019 Hi Brian, thank you that hook you provided corrects my output - after following the verification link it takes me back to the login page for whmcs and no longer shows the sidebar. 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.