mitch2k Posted July 12, 2015 Share Posted July 12, 2015 Hi, I'm trying to change the destinations for the network status links using hooks. I look trough the documentation (http://docs.whmcs.com/Client_Area_Navigation_Menus_Cheatsheet#Changing_where_a_Menu_Item_Points_To) I can change the link using this: $primaryNavbar->getChild('Network Status') ->setUri('http://mylink.com'); However, when the client is logged in, Network Status is no longer a top item, but a child of Support, so I should use: $primaryNavbar->getChild('Support') ->getChild('Network Status') ->setUri('http://www.mylink.com'); But if I use one of the 2, the other one gives a blank page. So if I use the first piece of code, I get a blank page when the client logs in (because $primaryNavbar->getChild('Network Status') is invalid). I could catch this of with an if statement to check if the client is logged in. But, if I want to also change the secondary navbar link, I have to use: $secondaryNavbar->getChild('Support') ->getChild('Network Status') ->setUri('http://www.mylink.com'); I could also work around this with double if statement (logged in + page is a page where the secondary navbar is shown), but this seems a bit inefficient. Is there a way to check if check if the child exists? Something like: if ($secondaryNavbar->getChild('Network Status') = true) { $secondaryNavbar->getChild('Network Status') ->setUri('http://www.mylink.com'); } Or is there a way that the statement is just ignored if the specified child does not exist? Thanks! 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.