Web Host Pro Posted March 21, 2017 Share Posted March 21, 2017 I can seem to find where in the hooks files you would add another link to show up in the account section of the top menu. https://webhost.pro/index.php It looks like it's called: TMSecondaryNavbar.php But when I add a new hook there nothing adds to the menu. Thanks, Charley 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 21, 2017 Share Posted March 21, 2017 Charley, it's going to be something along the lines of... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { if (!is_null($secondaryNavbar->getChild('Account'))) { $secondaryNavbar->getChild('Account') ->addChild('brian', array( 'label' => 'Label Name', 'uri' => 'http://www.google.com', 'order' => 40, )); } }); you might need to change a few things - e.g the label name... and the child name (if you don't want to name it after me!). give it a .php filename, stick it in /includes/hooks and it should work. 0 Quote Link to comment Share on other sites More sharing options...
Web Host Pro Posted March 22, 2017 Author Share Posted March 22, 2017 Hmm, I added the file Affiliates.php With this code but no luck, these hooks are the death of me. I can seem to wrap my head around the formats: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { if (!is_null($secondaryNavbar->getChild('Account'))) { $secondaryNavbar->getChild('Account') ->addChild('affiliates', array( 'label' => 'Affiliates', 'uri' => 'affiliates.php', 'order' => 40, )); } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 23, 2017 Share Posted March 23, 2017 the code itself is fine - this is what the above hook does on my v7.1.2 dev.... whereas, if you look at your site using the Six template, I see this... that icon next to account, plus the cart being there immediately tells me that the secondary navbar is already being modified by a hook - probably the mysterious "TMSecondaryNavbar.php" - perhaps there's a clash with whatever that hook is doing and what the above hook is doing. I can see there is already an Affiliates link in your primary navbar, and you can't have two children with the same name (not label) in the same navbar - but as these are different navbars, that shouldn't matter. if I were you, i'd consolidate the navbar hooks all in one file (or 2 if you want to split them primary/secondary) - that way you only need to look in one place for changes to the navbar... if you've got multiple hooks trying to do different things to the same navbar, and if one isn't coded correctly, then you'll see errors (or more likely a blank screen!). 0 Quote Link to comment Share on other sites More sharing options...
Shareef Posted February 1, 2021 Share Posted February 1, 2021 Good day all I have noticed that the following code works to activate affiliates: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { if (!is_null($secondaryNavbar->getChild('Account'))) { $secondaryNavbar->getChild('Account') ->addChild('affiliates', array( 'label' => 'Affiliates', 'uri' => 'affiliates.php', 'order' => 40, )); } }); The only problem I have is to have this done for a specific individual who is already an activated affiliate in my WHMCS Dashboard. Can someone please explain to me how to get this activated for a specific affiliate ? Thank you in advanced 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.