Jump to content
ocastaned

Change URL for Home and Logo on WHMCS 7.2.1

Recommended Posts

I am trying to change the URL for menu "Home" and my Logo to redirect them to my website homepage. I just updated to WHMCS 7.2.1.

 

I hope you can help me guys.

Share this post


Link to post
Share on other sites

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://forum.whmcs.com/showthread.php?126234-How-do-you-change-the-breadcrumbs-or-sidebar-code&p=505822#post505822

Share this post


Link to post
Share on other sites

Thank you, for the Home menu worked fine, but for the Logo, I don't know where to add the URL I want to redirect to.

 

{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}

Share this post


Link to post
Share on other sites

just replace the "{$web_root}/index.php" part - either with a full site URL or maybe "../index.,php"

Share this post


Link to post
Share on other sites

Hey guys I hope this is still active. Im not  very good at this because it did not work for me I use cpanel file manager located the whmcs file added code to the template index file nothing changed. Please help  

Share this post


Link to post
Share on other sites
On 27/11/2019 at 03:05, Thomasmcdaniel9 said:

Hey guys I hope this is still active. Im not  very good at this because it did not work for me I use cpanel file manager located the whmcs file added code to the template index file nothing changed. Please help 

this old solution was to change the link used by your logo on the WHMCS page - from reading your other thread, I think your situation relates to changing the link on the home menu button, which would require a different solution.

Share this post


Link to post
Share on other sites
24 minutes ago, Md Rasel Khan said:

@brian! Is there any way to change the Logo URL by WHMCS hook? Not ''Home" URL, I want to change Logo URL.

you want to change the logo to use a remote URL image, or you want to change the URL that the logo links to ??

Share this post


Link to post
Share on other sites
10 minutes ago, brian! said:

you want to change the logo to use a remote URL image, or you want to change the URL that the logo links to ??

Sorry for the less information. I want to change the URL that the logo links to.

Share this post


Link to post
Share on other sites
<?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");

 

Share this post


Link to post
Share on other sites
8 minutes ago, 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");

 

Thanks a lot! How to open the link in new tab?

Share this post


Link to post
Share on other sites
10 minutes ago, Md Rasel Khan said:

Thanks a lot! How to open the link in new tab?

change the href line of code to...

$('a.logo').attr({href:'https://www.google.com',target:'_blank'});

Share this post


Link to post
Share on other sites
6 minutes ago, VirtualWorldGlobal said:

Hi,

How can I add a logo here while clients login to client Area ?  Thanks...  

ZDlVNKl.png

 

 

You will need to edit the template (.tpl) files and just add the logo as any other regular HTML. Or you can add with it CSS as well.

Share this post


Link to post
Share on other sites
21 hours ago, Md Rasel Khan said:

setUri link should be open in new tab. Please help me, thanks!

setURI just specified the URL to use, if you want more, you would need to use setAttribute....

your quoted code is about navbars, but the attachment is sidebars - i'll choose one as an example, but it's the same code for either...

    // Sidebar->Support->Blog/News
    if (!is_null($secondarySidebar->getChild('Support'))) {
        $secondarySidebar->getChild('Support')
        ->getChild('Announcements')
        ->setLabel("Blog/News")
        ->setUri('https://omnisoftit.com/blog')
        ->setAttribute('target','_blank')
        ->setOrder(0);
    }
4 hours ago, VirtualWorldGlobal said:

can a hook perform this action ?

<?php

# Show Logo On Login Page Hook
# Written by brian!

function show_logo_on_login_page_hook($vars) {
	
	if ($vars['showingLoginPage']) {
		$imageurl = 'https://upload.wikimedia.org/wikipedia/en/c/ce/SVG-logo.svg';
		$output .= '<script type="text/javascript">
$(document).ready(function(){
	 $("<img src=\"'.$imageurl.'\" >").insertBefore(".header-lined");
});
</script>';
		return $output;
	}
}
add_hook("ClientAreaHeaderOutput", 1, "show_logo_on_login_page_hook");

6KBHuyC.png

if the image isn't the correct size, then you will have set its dimension in the code - either as a CSS class which you had to the img tag, or specific width/height dimensions.

Share this post


Link to post
Share on other sites
11 hours ago, brian! said:

setURI just specified the URL to use, if you want more, you would need to use setAttribute....

your quoted code is about navbars, but the attachment is sidebars - i'll choose one as an example, but it's the same code for either...


    // Sidebar->Support->Blog/News
    if (!is_null($secondarySidebar->getChild('Support'))) {
        $secondarySidebar->getChild('Support')
        ->getChild('Announcements')
        ->setLabel("Blog/News")
        ->setUri('https://omnisoftit.com/blog')
        ->setAttribute('target','_blank')
        ->setOrder(0);
    }

 

Thanks! Is there any way to add this line on the head.tpl file by hook? Not by directly editing the head.tpl file.Screenshot_1.thumb.png.e69e527cfb236d303adc3ee2976f3b91.png

Share this post


Link to post
Share on other sites
7 hours ago, Md Rasel Khan said:

Is there any way to add this line on the head.tpl file by hook? Not by directly editing the head.tpl file.

 

Share this post


Link to post
Share on other sites

  

On 6/6/2020 at 5:45 PM, brian! said:

ideally, you wouldn't edit any template for this - it's really a task for a hook (otherwise you'll be editing the template after every update).


<?
add_hook('ClientAreaHeadOutput', 1, function($vars) {
	return '<link rel="icon" href="https://www.youstable.com/favicon.ico" />';
});

@brian! Thanks a lot!  Is there any way to add this custom CSS by hook?

image.png.d531031f5600b4b8c2b601ad8727614a.png

 

Share this post


Link to post
Share on other sites

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

Default code of HTML: 

<small>This page is restricted</small>

Maybe custom code of HTML: 

<small><i class="fa fa-lock"></i> Secured by 2048-bit SSL encryption</small>

image.thumb.png.a5c9fc9b9dd6b88c2e8523285570e235.png

Share this post


Link to post
Share on other sites
38 minutes ago, Md Rasel Khan said:

  

@brian! Thanks a lot!  Is there any way to add this custom CSS by hook?

image.png.d531031f5600b4b8c2b601ad8727614a.png

 

@brian! I have added the custom CSS using your way. 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?

Screenshot_4.png.a071f2b6160bb80fea77e5be20d49414.png

Thanks!

Share this post


Link to post
Share on other sites

Thanks @brian!

 

On 11/13/2020 at 9:36 PM, brian! said:

<?php # Show Logo On Login Page Hook # Written by brian! function show_logo_on_login_page_hook($vars) { if ($vars['showingLoginPage']) { $imageurl = 'https://upload.wikimedia.org/wikipedia/en/c/ce/SVG-logo.svg'; $output .= '<script type="text/javascript"> $(document).ready(function(){ $("<img src=\"'.$imageurl.'\" >").insertBefore(".header-lined"); }); </script>'; return $output; } } add_hook("ClientAreaHeaderOutput", 1, "show_logo_on_login_page_hook");

 

 

Share this post


Link to post
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