Jump to content

Change URL for Home and Logo on WHMCS 7.2.1


Recommended Posts

20 hours ago, Md Rasel Khan said:

Is there any way to add this custom CSS by hook?

there is a custom.css file in your active theme /css folder - that's where WHMCS would expect you to add custom CSS... just remember that if you're using Six (and I can you are), keep a copy of the custom.css file as WHMCS will overwrite it during an update.

19 hours ago, Md Rasel Khan said:

And how can I replace the marked (1) text with the marked (2) text by hook?

no hook needed for this - use Language Overrides to change existing strings - don't edit the original language files...

$_LANG['restrictedpage'] = "This page is restricted";
19 hours ago, Md Rasel Khan said:

I have added the custom CSS using your way.

I didn't suggest adding CSS to the client area via a hook! 

it's an option in the admin area as you don't where there are no custom css options, but in the client area, you already have an existing custom.css file that you can use for your CSS changes... again, just remember to keep a backup.

19 hours ago, Md Rasel Khan said:

Do you think it is a good practice? Or do you have better way? And in the future If I update the WHMCS this mystyle.css will be removed or not?

the only real reason to add mystyle.css via a hook is that it will NOT get deleted by the updater... personally, I wouldn't store a .css file in the hooks folder, I would move it to the /css folder within your active (*Six") /css folder....

having the css in the hooks folder would work - it just feels wrong and you'll be using files stored in various locations and so could make updating more difficult and confusing.

Link to comment
Share on other sites

On 11/15/2020 at 7:58 PM, brian! said:

the only real reason to add mystyle.css via a hook is that it will NOT get deleted by the updater... personally, I wouldn't store a .css file in the hooks folder, I would move it to the /css folder within your active (*Six") /css folder....

having the css in the hooks folder would work - it just feels wrong and you'll be using files stored in various locations and so could make updating more difficult and confusing.

So what you think If I keep the mystyle.css file in the six/css folder instead of the hook folder? And after the update, will this file be removed? 

Link to comment
Share on other sites

7 hours ago, Pitago said:

How to change the whmcs homepage logo link so that it can redirect to my website

  

On 11/12/2020 at 8:15 PM, brian! said:

<?php

# Change Logo URL Hook
# Written by brian!

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

 

Follow this...

Link to comment
Share on other sites

  • 2 weeks later...
On 20/05/2017 at 10:23 PM, brian! said:

php fil

 

On 20/05/2017 at 10:23 PM, brian! said:

the logo link is in header.tpl...

 

 


        {if $assetLogoPath}
           <a href="{$WEB_ROOT}/index.php" class="logo"><img src="{$assetLogoPath}" alt="{$companyname}"></a>
       {else}
           <a href="{$WEB_ROOT}/index.php" class="logo logo-text">{$companyname}</a>
       {/if}
 

 

and for the menu, add a .php file to /includes/hooks and add...

 

 


<?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('http://www.google.com');
   }
});
 

 

 

https://community.whmcs.com/showthread.php?126234-How-do-you-change-the-breadcrumbs-or-sidebar-code&p=505822#post505822

I need to change the redirection link of the home menu. while following your advice , I found that I don't have a hooks folder inside the include folder.  Should I add a new folder  named hooks ? and one more thing what should be the .php file  name to be added?

Link to comment
Share on other sites

On 20/05/2017 at 10:23 PM, brian! said:

the logo link is in header.tpl...

 

 


        {if $assetLogoPath}
           <a href="{$WEB_ROOT}/index.php" class="logo"><img src="{$assetLogoPath}" alt="{$companyname}"></a>
       {else}
           <a href="{$WEB_ROOT}/index.php" class="logo logo-text">{$companyname}</a>
       {/if}
 

 

and for the menu, add a .php file to /includes/hooks and add...

 

 


<?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('http://www.google.com');
   }
});
 

 

 

https://community.whmcs.com/showthread.php?126234-How-do-you-change-the-breadcrumbs-or-sidebar-code&p=505822#post505822

As mentioned for logo I  changed the header.tpl  file  and it worked fine.  But for Home menu  link As mentioned I've no hooks folder in include folder. Should I  add a new one and what should be name of the php file where that give code should be given ? Please advise..

Link to comment
Share on other sites

On 29/11/2020 at 03:34, Marudhu said:

But for Home menu  link As mentioned I've no hooks folder in include folder.

it's not the /includes folder that's within the /templates/six folder etc, there is a folder in your WHMCS main folder called 'includes' and inside there will be a folder called 'hooks' - that's where these hooks should go.

On 29/11/2020 at 03:34, Marudhu said:

Should I  add a new one and what should be name of the php file where that give code should be given ? Please advise..

the file can be called whatever you like - but no spaces and it must end .php

Link to comment
Share on other sites

  • 1 year later...

I use this hook to customize the logo url and it works perfectly, but I like to customize the logo link url according to the selected language.

Any suggestions on how to do this?

 

<?php

# Change Logo URL Hook
# Written by brian!

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

 

Link to comment
Share on other sites

  • 3 weeks later...
<?php

# Change Logo URL Hook
# Written by brian!

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

This script is only working on desktop devices, in mobile device url redirection not working

 

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