Swword Posted March 3, 2022 Share Posted March 3, 2022 Hello, I have a problem that I can't find the solution for several days unfortunately... I only want to change the menu, for now only change the "Network Status" page redirect For now it's the only thing I want to do, change the redirect if it's not possible then delete. Thank you all ! 0 Quote Link to comment Share on other sites More sharing options...
jds Posted March 8, 2022 Share Posted March 8, 2022 (edited) hi, I'm pretty sure this will work as I've used on my installation to redirect my Network Status to an external website. You'll firstly need to create a .php file (you can name it anything you want) in includes/hooks/ folder and paste and save the below code into the file <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Network Status'))) { $primaryNavbar->getChild('Network Status') ->setURI('add-website-here'); } }); Edited March 8, 2022 by jds 0 Quote Link to comment Share on other sites More sharing options...
Swword Posted March 8, 2022 Author Share Posted March 8, 2022 Salvation ! Thank you very much for your answer, it's very nice. Once I've done that I link the .php file to the pages then ? 0 Quote Link to comment Share on other sites More sharing options...
Swword Posted March 8, 2022 Author Share Posted March 8, 2022 I managed to make a redirection but finally not thanks to your code, but I finally found the file which allows to modify this menu. Only worries now it's the left menu the sidebar that I can't do 0 Quote Link to comment Share on other sites More sharing options...
jds Posted March 14, 2022 Share Posted March 14, 2022 On 8/03/2022 at 11:28 AM, Swword said: Salvation ! Thank you very much for your answer, it's very nice. Once I've done that I link the .php file to the pages then ? HI, nope, all you need to do is for example create myredirect.php paste the code I added and save in the Includes/hooks/ folder . The whmcs system will find the code so you don't need to change anything but obvs the link in the code to your website address. 0 Quote Link to comment Share on other sites More sharing options...
jds Posted March 14, 2022 Share Posted March 14, 2022 On 8/03/2022 at 1:03 PM, Swword said: I managed to make a redirection but finally not thanks to your code, but I finally found the file which allows to modify this menu. Only worries now it's the left menu the sidebar that I can't do HI, that's great, but best to create hooks like the code I added instead of changing theme / whmcs files as these maybe overwritten when being updated 0 Quote Link to comment Share on other sites More sharing options...
Swword Posted March 14, 2022 Author Share Posted March 14, 2022 Hello, thank you for your answers, it's nice! So I was able to do the code you said in include then hooks but the left menu still shows the same page I don't know why Thank you 🙂 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted March 14, 2022 Share Posted March 14, 2022 (edited) 28 minutes ago, Swword said: Hello, thank you for your answers, it's nice! So I was able to do the code you said in include then hooks but the left menu still shows the same page I don't know why Thank you 🙂 Because the above code is for navbar, not sidebar. https://developers.whmcs.com/themes/sidebars/ Edited March 14, 2022 by pRieStaKos 0 Quote Link to comment Share on other sites More sharing options...
Swword Posted March 15, 2022 Author Share Posted March 15, 2022 Good morning ! Ah ok only for the high bar, no worries thank you very much. I can't modify for the left menu with your link unfortunately... In addition I have the impression that on their own code there are certain errors such as for example here; <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $primarySidebar->getChild('My Account') ->getChild('Billing Information') ->setUri('https://www.example.com/billingInfo'); }); (( This is their base code )) While I believe it is necessary to add a tag to close: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $primarySidebar->getChild('My Account') ->getChild('Billing Information') ->setUri('https://www.example.com/billingInfo'); } <--- }); I also succeeded for the top navigation but only when you are disconnected, but when you connect it does not work. Thanks very much ! 0 Quote Link to comment Share on other sites More sharing options...
jds Posted March 21, 2022 Share Posted March 21, 2022 you may want to try the secondary sidebar, for mine it was under support id when checking the code even though it wasn't within a Sub category... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->getChild('Network Status') ->setAttribute('target', '_blank') ->setURI('add-website-here'); } }); The code "->setAttribute('target', '_blank') " will open the link in a new tab btw. 0 Quote Link to comment Share on other sites More sharing options...
Swword Posted March 22, 2022 Author Share Posted March 22, 2022 Hello, thank you very much for your answer. So once connected to my site, when I click on "Network Status" it always directs me to the basic WHMCS page. On the other hand, if I click again on "Network status" on the left, it directs me to the page I want, but suddenly I always have the other page displayed. 0 Quote Link to comment Share on other sites More sharing options...
jds Posted March 22, 2022 Share Posted March 22, 2022 52 minutes ago, Swword said: Hello, thank you very much for your answer. So once connected to my site, when I click on "Network Status" it always directs me to the basic WHMCS page. On the other hand, if I click again on "Network status" on the left, it directs me to the page I want, but suddenly I always have the other page displayed. Hi that’s correct, you will have main menus for logged and logged in users and then the sidebar menu too so will need to implement code for all 0 Quote Link to comment Share on other sites More sharing options...
Swword Posted March 22, 2022 Author Share Posted March 22, 2022 8 minutes ago, jds said: Salut, c'est exact, vous aurez des menus principaux pour les utilisateurs connectés et connectés, puis le menu de la barre latérale également, vous devrez donc implémenter du code pour tous Hey, thank you very much for your answers! So here is a screen of the top menu when you are connected : https://zupimages.net/up/22/12/571h.png ------------------------ Then it always brings me to this page : https://zupimages.net/up/22/12/k6c5.png ----------------------------------------- On the other hand, when I click on the left menu, your code works and of course brings me the page I want, https://zupimages.net/up/22/12/csga.png 0 Quote Link to comment Share on other sites More sharing options...
jds Posted March 23, 2022 Share Posted March 23, 2022 (edited) Quote Then it always brings me to this page : https://zupimages.net/up/22/12/k6c5.png Hey, yeh thats the standard network status page, another way if you are wanting to keep the users within your site is to add an iframe to bring in the page within the serverstatus.tpl file which will be in your templates/theme folder, make a backup of the file first then delete the content and add the following code below. <iframe src="website-here" width="1050" height="1000"></iframe> You can alter the width / height by changing the values. Here's the three lots of menus that need editing, at least is on my installation anyway.... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); if (!is_null($primaryNavbar->getChild('Network Status'))) { $primaryNavbar->getChild('Network Status') ->setAttribute('target', '_blank') ->setURI('add-website-here'); } if (!is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->getChild('Support') ->getChild('Network Status') ->setAttribute('target', '_blank') ->setURI('add-website-here'); } }); use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->getChild('Network Status') ->setAttribute('target', '_blank') ->setURI('add-website-here'); } }); If the above doesn't work try removing the $client = Menu::context('client'); Edited March 23, 2022 by jds 0 Quote Link to comment Share on other sites More sharing options...
Swword Posted March 23, 2022 Author Share Posted March 23, 2022 6 hours ago, jds said: Hé, ouais c'est la page d'état du réseau standard, une autre façon si vous voulez garder les utilisateurs sur votre site est d'ajouter un iframe pour amener la page dans le fichier serverstatus.tpl qui sera dans votre dossier templates/theme, faites une sauvegarde du fichier d'abord puis supprimez le contenu et ajoutez le code suivant ci-dessous. <iframe src="website-here" width="1050" height="1000"></iframe> Vous pouvez modifier la largeur/hauteur en changeant les valeurs. Voici les trois lots de menus qui ont besoin d'être édités, du moins c'est sur mon installation en tout cas.... Si ce qui précède ne fonctionne pas, essayez de supprimer le $client = Menu::context('client'); Hello, thank you for your answer. Then really thank you all for your help! The latest Jd code to work thank you 🙂 I was able to put the page on the site as you told 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.