dnhgeeks Posted May 22, 2016 Share Posted May 22, 2016 I have integrated WHMCS in dnhgeeks.com Please visit this page dnhgeeks.com/customers and see the header menu links for Announcements and Knowledgebase are broken and produce 404 error. I have viewed the template header.tpl file but it is smarty code and I cannot run php inside smarty templates. How to change the url of header menu links of WHMCS in a template? Where is the php code for generating the menu code in smarty ? Thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 22, 2016 Share Posted May 22, 2016 I have integrated WHMCS in dnhgeeks.com Please visit this page dnhgeeks.com/customers and see the header menu links for Announcements and Knowledgebase are broken and produce 404 error. I have viewed the template header.tpl file but it is smarty code and I cannot run php inside smarty templates. How to change the url of header menu links of WHMCS in a template? Where is the php code for generating the menu code in smarty ? how did you modify those two links in the menu? are they hard-coded links in a template or did you use a hook ?? with v6, modifications to the menu are made via action hooks... http://docs.whmcs.com/Editing_Client_Area_Menus as long as you haven't tried to modify the menu in a template or an existing hook, you should be able to correct the links using an action hook.. so create a file in /includes/hooks/ and call it 'dnhgeekmenu.php' and add the following code to it... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->getChild('Announcements') ->setURI('http://dnhgeeks.com/customers/?ccce=announcements'); } if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Knowledgebase') ->setURI('http://dnhgeeks.com/customers/?ccce=knowledgebase'); } }); all being well, that should correctly modify the links... if it doesn't, then there is another modification in the background that you'll need to track down. 0 Quote Link to comment Share on other sites More sharing options...
dnhgeeks Posted May 22, 2016 Author Share Posted May 22, 2016 Hi Brian!, I have not changed any links in it, they are like this after installation. Thank you for your solution. It worked for the header menu links. I have updated the links of header menu but when I use the same code for sidebar menu it is not working. On this page, http://dnhgeeks.com/customers/?ccce=knowledgebase, the announcements, knowledgebase and downloads link in secondary sidebar are not correct. I have added the following code add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Announcements'))) { $secondarySidebar->getChild('Announcements') ->setURI('http://dnhgeeks.com/customers/?ccce=announcements'); } if (!is_null($secondarySidebar->getChild('Knowledgebase'))) { $secondarySidebar->getChild('Knowledgebase') ->setURI('http://dnhgeeks.com/customers/?ccce=knowledgebase'); } if (!is_null($secondarySidebar->getChild('Downloads'))) { $secondarySidebar->getChild('Downloads') ->setURI('http://dnhgeeks.com/customers/?ccce=downloads'); } }); Similarly, on page http://dnhgeeks.com/customers/?ccce=announcements to change the link of RSS Feeds on primary sidebar, I have added the following code add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('RSS Feed'))) { $primarySidebar->getChild('RSS Feed') ->setURI('http://dnhgeeks.com/customers/?ccce=announcementsrss'); } }); None of these two codes are working. What is the problem with these two codes ? What will be the code to update the links in these menus ? 0 Quote Link to comment Share on other sites More sharing options...
dnhgeeks Posted May 26, 2016 Author Share Posted May 26, 2016 I have found the solution for updating sidebar menu items. The sidebar menu items will be updated with the same code in previous post, only the menu items parent needs to be added. Add the parent to menu item code for Announcements RSS using the following code $primarySidebar->getChild('Announcements Months') ->getChild('RSS Feed') ->setUri('http://dnhgeeks.com/customers/?ccce=announcementsrss'); Thank You 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.