Jump to content

Home Link


INEEDHELP

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 2 years later...
  • 2 months later...

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 by Anders
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 7 months later...
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...

  1. create a .php file in /includes/hooks.
  2. copy & paste the code I posted, e.g here into the above .php file.
  3. save. 🙂

https://developers.whmcs.com/hooks/getting-started/

Link to comment
Share on other sites

  • 6 months later...
  • 2 years later...

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 !Capture.PNG.ad65b033481c442cdcffb04eedd90bad.PNG

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated