mifta Posted March 2, 2020 Share Posted March 2, 2020 Hello i have a third part module and it Just have admin area and i want to add a feature in client area so i added a hooks, but when i added it the submenu appear but when i clicked it there's warningg " opps could t find that Page" 0 Quote Link to comment Share on other sites More sharing options...
jimsweb Posted October 3, 2020 Share Posted October 3, 2020 yes, setUri seems no longer working after v8.0 upgrade. Any assistance, anyone? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 4, 2020 Share Posted October 4, 2020 15 hours ago, jimsweb said: yes, setUri seems no longer working after v8.0 upgrade. are you sure?? if I write a quick hook to change the link on the home navbar, it works fine... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->getChild('Home')->setUri('https://google.com'); } }); On 02/03/2020 at 04:14, mifta said: Hello i have a third part module and it Just have admin area and i want to add a feature in client area so i added a hooks, but when i added it the submenu appear but when i clicked it there's warningg " opps could t find that Page" enable error reporting and it should give you more details as to the cause of the error... https://docs.whmcs.com/Enabling_Error_Reporting 0 Quote Link to comment Share on other sites More sharing options...
sclemance Posted October 9, 2020 Share Posted October 9, 2020 (edited) I'm having the same (similar?) issue which happened after our version 8 update. My WHMCS's primary domain is being prepended to the URI as such: if (!is_null($primaryNavbar->getChild('Support')->getChild('Tickets'))) { $primaryNavbar->getChild('Support')->getChild('Tickets')->setUri('https://theintendeduri.com/targetpage'); $primaryNavbar->getChild('Support')->getChild('Tickets')->setAttribute("target", '_blank'); } Produces this link: https://ourwhmcsdomain.com/https://theintendeduri.com/targetpage This, of course, will produce a 404. Edited October 9, 2020 by sclemance Code snippet correction... 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 22, 2020 Share Posted October 22, 2020 On 09/10/2020 at 05:04, sclemance said: 'm having the same (similar?) issue which happened after our version 8 update. My WHMCS's primary domain is being prepended i'm not seeing this occurring on v8.0.3 - regardless of Friendly URLs settings. 0 Quote Link to comment Share on other sites More sharing options...
sclemance Posted October 22, 2020 Share Posted October 22, 2020 Updated to v8.0.3 from .2 and it's still occurring. Could it have anything to do with the fact that our WHMCS installation is running on Nginx? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 22, 2020 Share Posted October 22, 2020 14 minutes ago, sclemance said: Could it have anything to do with the fact that our WHMCS installation is running on Nginx? it's possible I suppose.... what happens if you try the redirection example in the docs...? https://docs.whmcs.com/Client_Area_Navigation_Menus_Cheatsheet#Changing_where_a_Menu_Item_Points_To 0 Quote Link to comment Share on other sites More sharing options...
sclemance Posted October 22, 2020 Share Posted October 22, 2020 After some testing, it seems if I use (or concatenate) a variable, such as $myUri, it prepends the base installation URL. Specifically, if I do this: $navItem->setUri('https://newsite.com'); It works, and I get a link that looks like this: 'https://newsite.com' This also seems to work fine: $moreStuff = '/support'; $navItem->setUri('https://newsite.com' . $moreStuff); ...and I get a link that looks like: 'https://newsite.com/supprt' But if I do this: $myUri = 'https://newsite.com/support?client=' . $clientName; $navItem->setUri($myUri); ...the link ends up looking like this: 'https://mywhmcsurl.com/https://newsite.com/support?client=MrCustomer' And if I do this: $navItem->setUri('noProtocolOrDomain'); ...I get a link that looks like this: 'https://mywhmcsurl.com/noProtocolOrDomain' Leading me to believe there is some sort of glitch with the way WHMCS is parsing the URL parameters before intelligently deciding if the base URL needs to be prepended. Any thoughts? UPDATE: As I was about to submit this, I realized that even though the link produced with the prepended base WHMCS URLs looked okay otherwise, (and even worked if I chopped off the prepended bit), I wasn't using urlencode on the variables. Individually using urlencode on each variable allowed WHMCS to parse the string correctly and it's working now. We'll chalk that up to my rusty coding and 'zen-less' disposition lately. I'll leave my mess above in the post in case it helps anyone else. 0 Quote Link to comment Share on other sites More sharing options...
iwanndie Posted February 15, 2021 Share Posted February 15, 2021 (edited) This is also a issue for me. $primaryNavbar->addChild('Dashboard') ->setUri('https://client.domain.io/') ->setIcon('fa-tachometer') ->setOrder(1); Creates a functioning item, with a icon. However, URI doesn't change at all. Edited February 15, 2021 by iwanndie 0 Quote Link to comment Share on other sites More sharing options...
bear Posted February 15, 2021 Share Posted February 15, 2021 7 minutes ago, iwanndie said: https://client.domainio Is that a typo? Doesn't seem to be valid URI. 0 Quote Link to comment Share on other sites More sharing options...
iwanndie Posted February 15, 2021 Share Posted February 15, 2021 1 minute ago, bear said: Is that a typo? Doesn't seem to be valid URI. It's just a placeholder. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 16, 2021 Share Posted February 16, 2021 19 hours ago, iwanndie said: However, URI doesn't change at all. are you sure? your hook code works fine for me... 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.