Thomasmcdaniel9 Posted November 26, 2019 Share Posted November 26, 2019 Hello sorry if this is in the wrong area. But I have question I have Whmcs installed and working. But my issue is once I leave my main website to the billing or domain search area I would like to click Home button and redirect back to my home page not the whmcs theme home page. Please help thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 28, 2019 Share Posted November 28, 2019 Hi Thomas, On 26/11/2019 at 06:00, Thomasmcdaniel9 said: once I leave my main website to the billing or domain search area I would like to click Home button and redirect back to my home page not the whmcs theme home page. you can't change that from the admin settings, you would need to use an action hook (a php file that you upload to /includes/hooks) and change the link via that method. the logo will usually direct back to the main site, or if it doesn't, that can be changed by editing the template as per the other thread, I posted a hook in the thread below that would change the home button to redirect to clientarea.php for clients that were not logged in - in your case, you would change the 'clientarea.php' part of the hook to the URL of your site. as I mentioned in that thread, when a user is not logged in, the home button redirects them to the index page of whmcs; when they are logged in, it redirects them to clientarea.php - so the above hook only changes the URL for those that are not logged in; for those that are, they will still be redirected to clientarea.php as before... if you wanted to change the URL of that Home button for everyone, you would just simplify the IF statement... <?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'); } }); what you might need to do is have a think about where this button redirects to, and for which users (e.g whether they are logged in or not) - because with this home button changed, logged in users would have no quick way to get back to the clientarea.php (other than clicking back in the browser)... you could add another menu button, using a hook, that went to your real home page, but as I say, you need to think about the navigation process for the user and how best not to confuse them! 0 Quote Link to comment Share on other sites More sharing options...
Thomasmcdaniel9 Posted November 28, 2019 Author Share Posted November 28, 2019 3 hours ago, brian! said: Hi Thomas, you can't change that from the admin settings, you would need to use an action hook (a php file that you upload to /includes/hooks) and change the link via that method. the logo will usually direct back to the main site, or if it doesn't, that can be changed by editing the template as per the other thread, I posted a hook in the thread below that would change the home button to redirect to clientarea.php for clients that were not logged in - in your case, you would change the 'clientarea.php' part of the hook to the URL of your site. as I mentioned in that thread, when a user is not logged in, the home button redirects them to the index page of whmcs; when they are logged in, it redirects them to clientarea.php - so the above hook only changes the URL for those that are not logged in; for those that are, they will still be redirected to clientarea.php as before... if you wanted to change the URL of that Home button for everyone, you would just simplify the IF statement... <?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'); } }); what you might need to do is have a think about where this button redirects to, and for which users (e.g whether they are logged in or not) - because with this home button changed, logged in users would have no quick way to get back to the clientarea.php (other than clicking back in the browser)... you could add another menu button, using a hook, that went to your real home page, but as I say, you need to think about the navigation process for the user and how best not to confuse them! Thanks Brian . the only issue i was having was finding the file that i needed to insert the code into . in my case in Cpanel file manager. { /Home/ Bililling.Mywebsitesubdomain/Includes/hooks/home.php } That is the file i had to modify but it works perfect <?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://YOURWEBSITE.com/'); }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 29, 2019 Share Posted November 29, 2019 21 hours ago, Thomasmcdaniel9 said: the only issue i was having was finding the file that i needed to insert the code into . in my case in Cpanel file manager. I assumed you were going to create a new file - but if there was already an existing hook file there, and you were able to modify it and it works, then it's all good. 🙂 0 Quote Link to comment Share on other sites More sharing options...
Thomasmcdaniel9 Posted November 29, 2019 Author Share Posted November 29, 2019 Yes sir i was going to but i normally just save the original code just in case. i can just paste it back in but yes it worked.😉 Keep up the good work with your post they are very knowledgeable for us Whmcs newbies. 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.