magicgirl Posted June 19, 2018 Share Posted June 19, 2018 hello folk, I am sandra from germany and totally happy with whmcs. But I have a question about the "changing where a menu item links to". https://developers.whmcs.com/themes/navigation/ I read it and can not understand in which file I have to put this inside? So where I have to put the seturi file inside and which parameters do i have to change ? <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $navItem = $primaryNavbar->getChild('Support'); if (is_null($navItem)) { return; } $navItem = $navItem->getChild('Announcements'); if (is_null($navItem)) { return; } $navItem->setUri('https://www.example.com/3rdpartyblogsystem'); could you please help me 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 21, 2018 Share Posted June 21, 2018 you create a .php file within /includes/hooks and paste your code into it... 0 Quote Link to comment Share on other sites More sharing options...
redit Posted June 21, 2018 Share Posted June 21, 2018 Hi @magicgirl You have two options in the way that you can do this both will give you the same result but the 'hook' option is the better (in my opinion). The first option is to locate either the 'header.tpl' or 'navbar.tpl' files that are located inside your template directory (for example) '/var/www/html/whmcs/templates/my_template_name/includes/navbar.tpl' you can then edit the menu item directly in there once you have located it. Or the better option is to create a 'hooks' folder in you template directory (/var/www/html/whmcs/templates/my_template_name/includes/hooks/) and then add a new file in there with the code above which will then 'overwrite' what has been generated by the whmcs default template. Details about how the hooks work can be found at https://developers.whmcs.com/hooks/ 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 22, 2018 Share Posted June 22, 2018 21 hours ago, redit said: The first option is to locate either the 'header.tpl' or 'navbar.tpl' files that are located inside your template directory (for example) '/var/www/html/whmcs/templates/my_template_name/includes/navbar.tpl' you can then edit the menu item directly in there once you have located it. I wouldn't suggest editing the navbar.tpl unless you know what you're doing - and a new user is highly unlikely to know how to do it. 21 hours ago, redit said: Or the better option is to create a 'hooks' folder in you template directory (/var/www/html/whmcs/templates/my_template_name/includes/hooks/) and then add a new file in there with the code above which will then 'overwrite' what has been generated by the whmcs default template. that's incorrect advice - the /includes/hooks/ directory already exists within the root of your WHMCS installation and contains an example.php hook file - there is no need to create an /includes/hooks/ folder inside your current template folder - and any hook files in there wouldn't work anyway. 1 Quote Link to comment Share on other sites More sharing options...
redit Posted June 22, 2018 Share Posted June 22, 2018 @brian! I was trying to give all the options available as not knowing the posters level. And thank you for spotting the error you are of course 100% correct on the location of the hook folder, that will teach me to double check what I write in future. ~Regards, Scott 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.