Jump to content

Hook to change the Header icon from Portal home to Homepage


Davor

Recommended Posts

Hello,

I have a hook that redirects the Home navigation from Portal home to my Homepage:

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   if (!is_null($primaryNavbar->getChild('Home'))) {
           $primaryNavbar->getChild('Home')
                       ->setURI('../');
   }
});

 

 

But can't find a hook to change when a user clicks on the Icon in the Header to also change it to homepage and not to the Portal home.

Been looking for hours now, but no luck.

 

 

whmcs.png

Link to comment
Share on other sites

I got it.

If anyone else needs this, here is the solution.

But you need to take into consideration that every WHMCS System Theme (General Settings > General > System Theme) is obviously having a different class for the logo image.

Here is the hook code:

#works, but each WHMCS  System Theme is having different class for the logo image
#   WHMCS System Theme Six is a.logo
#   WHMCS System Theme Twenty-One is a.navbar-brand

function change_logo_url_hook($vars) {
	
	return "<script>
$(function(){
   $('a.logo').attr('href','https://www.MyHomepage.com');
   $('a.navbar-brand').attr('href','https://www.MyHomepage.com');
});
</script>";
}
add_hook("ClientAreaHeadOutput", 1, "change_logo_url_hook");

 

Link to comment
Share on other sites

  • 1 month later...
On 31/08/2021 at 21:34, Davor said:

Been looking for hours now, but no luck.

it's out there!

that's where you copied *my* code from - it's not difficult to link to the original thread, rather than imply that you wrote it yourself! 🙄

On 02/09/2021 at 20:07, Davor said:

But you need to take into consideration that every WHMCS System Theme (General Settings > General > System Theme) is obviously having a different class for the logo image.

then you get the hook to find the current theme name and react accordingly.... as I mention in the above thread! 🙄

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.

×
×
  • 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