StarburstHost Posted November 15, 2020 Share Posted November 15, 2020 (edited) I moved my installation to a sub-directory with it own sub-name now. I need to change the "Home" URL from the default /index.php to https://starbursthsoting.com Looked at: https://developers.whmcs.com/themes/navigation/ But am confused, on what to call the file and where to save it. If someone could double check, I think I have it correct below: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $navItem = $primaryNavbar->getChild('Home'); if (is_null($navItem)) { return; } $navItem->setUri('https://starbursthosting.com'); }); Edited November 15, 2020 by StarburstHosting 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted November 15, 2020 Share Posted November 15, 2020 Setup > General Settings > General. Change Domain and WHMCS System URL accordingly. 0 Quote Link to comment Share on other sites More sharing options...
StarburstHost Posted November 15, 2020 Author Share Posted November 15, 2020 2 hours ago, Kian said: Setup > General Settings > General. Change Domain and WHMCS System URL accordingly. Tried that. 😕 Domain is set to https://starbursthosting.com WHMCS System URL is set to https://portal.starbursthosting.com But Home still takes you to https://portal.starbursthosting.com/index.php 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 15, 2020 Share Posted November 15, 2020 1 minute ago, Kian said: Setup > General Settings > General. Change Domain and WHMCS System URL accordingly. I read the question more as he wants to redirect the home button to the parent site without the included index.php - changing the system URL from the existing subdomain URL where WHMCS is now hosted wouldn't do that and would probably stop WHMCS from working. 4 hours ago, StarburstHosting said: But am confused, on what to call the file and where to save it. it needs to be a .php file in the /includes/hooks directory - you could call it "navbar_home.php" and then paste the above code into it and save. 4 hours ago, StarburstHosting said: If someone could double check, I think I have it correct below: it's not the way I would do it, but it would work. one thing worth mentioning is that when a user is logged in, that "home" button in the portal would redirect to clientarea.php (e.g the client area home page) - but with this hook, everyone (logged in or not) will have this button redirecting to the main home page. that may or may not be a good thing for your situation (though might leave the user no obvious way to get to their portal home), so you might have to consider only redirecting the home button to your domain if the client is not logged in. 0 Quote Link to comment Share on other sites More sharing options...
StarburstHost Posted November 15, 2020 Author Share Posted November 15, 2020 (edited) Thanks Brian, How would I do it just or non-clients, like you mentioned in the last paragraph? Edited November 15, 2020 by StarburstHosting 0 Quote Link to comment Share on other sites More sharing options...
StarburstHost Posted November 15, 2020 Author Share Posted November 15, 2020 (edited) Tried the below, and had placed in /includes/hooks But didn't work either. <?php add_hook('Primary_Navbar-Home', 1, function (MenuItem $primaryNavbar) { $navItem = $primaryNavbar->getChild('Home'); if (is_null($navItem)) { return; } $navItem->setUri('https://starbursthosting.com'); }); Edited November 15, 2020 by StarburstHosting 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 15, 2020 Share Posted November 15, 2020 14 minutes ago, StarburstHosting said: How would I do it just or non-clients, like you mentioned in the last paragraph? the way I would do it is... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); if (is_null($client) && !is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->getChild('Home')->setURI('https://starbursthosting.com'); } }); 0 Quote Link to comment Share on other sites More sharing options...
StarburstHost Posted November 15, 2020 Author Share Posted November 15, 2020 22 minutes ago, brian! said: the way I would do it is... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); if (is_null($client) && !is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->getChild('Home')->setURI('https://starbursthosting.com'); } }); Thank You very much for your help. Just uploaded and is working. 🙂 0 Quote Link to comment Share on other sites More sharing options...
obee Posted March 26, 2023 Share Posted March 26, 2023 thank you this thread helped me out too. however i noticed that when a logged in user logs out, it takes the client to the whmcs home page still. so, what code can i use to have the client go to the parent site in such a case aswell? 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted April 11, 2023 Share Posted April 11, 2023 On 3/26/2023 at 9:40 PM, obee said: thank you this thread helped me out too. however i noticed that when a logged in user logs out, it takes the client to the whmcs home page still. so, what code can i use to have the client go to the parent site in such a case aswell? Remove is_null($client) from code. Leave the other. 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.