INEEDHELP Posted July 24, 2017 Share Posted July 24, 2017 How can I change the "home" link to my site's main index? As of now when I click it the button takes me to the main WHMCS area. I looked this up and from what I read it says edit header.tpl I couldn't find anything in that file that looked like it would solve my issue. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 24, 2017 Share Posted July 24, 2017 you're going to need to use a hook - second block of code from the thread below... https://forum.whmcs.com/showthread.php?129218-Change-URL-for-Home-and-Logo-on-WHMCS-7-2-1&p=516622#post516622 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted July 24, 2017 Share Posted July 24, 2017 I am using //Add House icon for Home Link for logged in clients if (!is_null($primaryNavbar->getChild('Home'))){ $primaryNavbar->getChild('Home') ->setIcon('fa-home'); $primaryNavbar->getChild('Home') ->addChild('Client Area Home', array( 'uri' => 'clientarea.php', 'order' => '10', )); } but it adds the Client Area Home even when visiting the site as a guest, how can I make is so the child link is only shown when logged in? 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted July 24, 2017 Share Posted July 24, 2017 Got it sorted! 0 Quote Link to comment Share on other sites More sharing options...
Creative Yadley Posted December 28, 2019 Share Posted December 28, 2019 Hey Brian! This hook you posted in 2017 has changed my life here now in 2019. Thanks plenty for sharing. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 29, 2019 Share Posted December 29, 2019 On 28/12/2019 at 11:03, Creative Yadley said: Hey Brian! This hook you posted in 2017 has changed my life here now in 2019. Thanks plenty for sharing. i'm glad to have contributed to your life changing experience! 😲 0 Quote Link to comment Share on other sites More sharing options...
Anders Posted March 15, 2020 Share Posted March 15, 2020 (edited) hi, i am struggling little bit with the menu hook script as i am not a coder, i manage to add a new home button to my home page, but also want to change the Whmcs area "Home" button go from http://mywebsitet/whmcs/index.php to http://mywebsitet/whmcs/clientarea.php when users are logged out. any ideas? this is how my code is now #adding Menu Item to primaryNavbar use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); /** @var \WHMCS\View\Menu\Item $primaryNavbar */ $newMenu = $primaryNavbar->addChild( 'uniqueMenuItemName', array( 'name' => 'Home', 'label' => Lang::trans('hometitle'), 'uri' => 'https://my site/', 'order' => 1, 'icon' => 'fa-home', ) ); }); Edited March 15, 2020 by Anders 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 15, 2020 Share Posted March 15, 2020 new home link with icon for everyone, previous home link going to clientarea.php (for non clients) - e.g they have to login. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); $primaryNavbar->addChild('newhome',array('label' => Lang::trans('hometitle'),'uri' => 'https://my site/','order' => 1,'icon' => 'fa-home',)); if (!$client && !is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->getChild('Home')->setUri('clientarea.php'); } }); although in many ways that if statement is redundant because the link would go to clientarea.php anyway for logged in users, so you could just make it go there for everyone. 0 Quote Link to comment Share on other sites More sharing options...
Anders Posted March 15, 2020 Share Posted March 15, 2020 super thx again and again :) i forgot to explain that when user logout they come back to http://mywebsitet/whmcs/index.php could that be change to be redirected clientarea.php so they will see a login area again. what i am trying archive is not using the index.php with domain search and the other stuff as i already have that on my wordpress page. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 16, 2020 Share Posted March 16, 2020 17 hours ago, Anders said: i forgot to explain that when user logout they come back to http://mywebsitet/whmcs/index.php could that be change to be redirected clientarea.php so they will see a login area again. there is a setting in setup -> general settings -> other that prevents users seeing the homepage and redirects them to the clientarea.php https://docs.whmcs.com/Other_Tab#Default_to_Client_Area Quote Normally when clients and visitors visit your WHMCS installation they are presented with the homepage listing the various pages; client area, submit ticket, view tickets, place order etc. Ticking this option skips this page and takes visitors directly to the client area prompting them to login. you can tell the above text was written years ago when the homepage of the client area was just a series of links to various pages. 😋 17 hours ago, Anders said: what i am trying archive is not using the index.php with domain search and the other stuff as i already have that on my wordpress page. I think the above should take care of that, but should you ever really wish to redirect a user elsewhere when they logout, I did post a simple hook last year where you could specify a URL to redirect them to after logging out. 0 Quote Link to comment Share on other sites More sharing options...
CheesyBeanz Posted November 3, 2020 Share Posted November 3, 2020 Hi, sorry for bringing this up again. Once I've created the PHP file containing the Hook, obviously I just don't do that. What other code needs to go where??? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 4, 2020 Share Posted November 4, 2020 19 hours ago, CheesyBeanz said: Once I've created the PHP file containing the Hook, obviously I just don't do that. What other code needs to go where??? the process would be to... create a .php file in /includes/hooks. copy & paste the code I posted, e.g here into the above .php file. save. 🙂 https://developers.whmcs.com/hooks/getting-started/ 0 Quote Link to comment Share on other sites More sharing options...
S4hosting Posted May 27, 2021 Share Posted May 27, 2021 On 4/11/2020 at 8:31 PM, brian! said: the process would be to... create a .php file in /includes/hooks. copy & paste the code I posted, e.g here into the above .php file. save. 🙂 https://developers.whmcs.com/hooks/getting-started/ hey what would be the php file name shall i name it like menu.php? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 1, 2021 Share Posted June 1, 2021 On 27/05/2021 at 03:08, s4talk hosting said: hey what would be the php file name shall i name it like menu.php? yes. 🙂 https://developers.whmcs.com/hooks/getting-started/ 1 Quote Link to comment Share on other sites More sharing options...
ilyas568 Posted January 14 Share Posted January 14 Sorry to bring this up, the php you gave above give me twice home, one works perfectly to my site but the other one redirect me to the login page and I don't need that., Is there a way to get rid off the second one? Thank you ! 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.