rezabagh Posted January 29, 2016 Share Posted January 29, 2016 hello i use the bellow hook for adding a menu when user is not logged in , and it works fine , but now i need a hook to add a menu for users which are logged in , how should i edit this hook to get the result ? NEED your help Thanks <?php #adding Menu Item to primaryNavbar use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); // only add menu item when no client logged in if (is_null($client)) { $primaryNavbar->addChild('test') ->setUri('test.php') ->setOrder(10); } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 29, 2016 Share Posted January 29, 2016 if the user is not logged in, the hook below will create a "test" navbar item; if they are logged in, it will show "test2"... <?php #adding Menu Item to primaryNavbar use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); // only add menu item when no client logged in if (is_null($client)) { $primaryNavbar->addChild('test') ->setUri('test.php') ->setOrder(10); } // only add menu item when client logged in if (!is_null($client)) { $primaryNavbar->addChild('test2') ->setUri('test2.php') ->setOrder(10); } }); 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.