AffordableDomainsCanada Posted June 4, 2016 Share Posted June 4, 2016 I am trying to create a hook for the nav bar. I am trying to add a link the parent link would be 'Reviews' with the link going to your domain.ca/reviews.php and then a child but would only be displayed if logged in and the title would be 'Submit Review' and the url link would be yourdomain.ca/submitreview.php I have been playing around with this for over an hour now and cant figure this out, can someone please help. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 5, 2016 Share Posted June 5, 2016 Create new PHP file inside /includes/hooks/ directory, with "anyname.php", put the following code inside it: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook("ClientAreaPrimaryNavbar", 1, function (MenuItem $primaryNavbar){ $client = Menu::context("client"); $reviews = $primaryNavbar->addChild("Reviews") ->setURI("reviews.php") ->setLabel("Reviews") ->setOrder(70); if (!is_null($client)){ /* $reviews->addChild("BrowseReviews") ->setURI("reviews.php") ->setLabel("Reviews") ->setOrder(1); */ $reviews->addChild("AddReview") ->setURI("submitreview.php") ->setLabel("Submit Review") ->setOrder(2); } }); 1 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted June 5, 2016 Author Share Posted June 5, 2016 Awesome! Thank you so much for your assistance! 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.