Jump to content

Hook - How we can redirect sidebar url to another url


ody

Recommended Posts

Hello,

 

I'm trying with a hook php order to redirect

https://domain/cart.php?a=add&domain=register

to default main page

http://domain/domainchecker.php

 

I'll try

 

<?php

 

use WHMCS\View\Menu\Item as MenuItem;

 

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)

{

$secondarySidebar->getChild('Actions')

->getChild('Domain_Registration')

->setUri('https://domain/domainchecker.php');

});

 

or

 

<?php

 

use WHMCS\View\Menu\Item as MenuItem;

 

add_hook('SecondarySidebar', 1, function(MenuItem $SecondarySidebar)

{

$SecondarySidebar->getChild('Actions')

->getChild('Domain_Registration')

->setUri('https://domain/domainchecker.php');

});

or

 

<?php

 

use WHMCS\View\Menu\Item as MenuItem;

 

add_hook('Secondary_Sidebar', 1, function(MenuItem $secondary_Sidebar)

{

$Secondary_Sidebar->getChild('Actions')

->getChild('DomainRegistration')

->setUri('https://Domain/domainchecker.php');

});

 

But ....

 

Thank you in advance

Ody

Link to comment
Share on other sites

I can see two points with this...

 

1. you'll need to check that the sidebar exists before trying to modify it...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) {

   if (!is_null($secondarySidebar->getChild('Actions'))) {
                $secondarySidebar->getChild('Actions')
                                 ->getChild('Domain Registration')
                                 ->setUri('domainchecker.php');
   }
}); 

2. if you're trying to use this on v7, then it's probably pointless - in v7, domainchecker.php is basically just a dummy file that redirects to "cart.php?a=add&domain=register"... so by changing the sidebar link to domainchecker, it's still going to redirect to the cart - that's how v7 works now. :idea:

Link to comment
Share on other sites

Solved !!! in a moment !!!

& Works !!!

as we still use 7.0.1 we haven't upgrade our version as when we do that "mess-mess-mess"

WHMCS every week have a new release.... without many serious changes and most times bring more problems than to solve them.

 

Thank you Brian,

Brian The Best WHMCS Support Team All In ONE Person!

If you ever Brian decide to open a WHMCS support site-service we and I believe some thousands other WHMCS users we shall follow you, as a client always,

I prefer to pay a Brian support service than the original WHMCS support Service.

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