Hi wondering if you can help me out,
I tried following all of the above, I managed to get it working if logged in but for logged out users it would chuck them up with an oops page.
I have done some debugging and put some code back in and no more errors but the hook is no longer changing the URL. can I pick your brains for a moment and take a look at the code I am using and point me in the right direction?
All I am trying to achieve is to redirect the standard knowledge base article links in the menu / secondary menu etc to another URL
Thanks
<?php
# Menu/Sidebar Link Changes Hook for CJF077
# Written by brian!
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
if (!is_null($primaryNavbar->getChild('Knowledgebase'))) {
$primaryNavbar->getChild('Knowledgebase')
->setURI('https://google.com');
}
if (is_null($primaryNavbar->getChild('Support'))) {
return;
}
if (!is_null($primaryNavbar->getChild('Support')->getChild('Knowledgebase'))) {
$primaryNavbar->getChild('Support')
->getChild('Knowledgebase')
->setURI('https://google.com');
}
});
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
if (is_null($secondarySidebar->getChild('Support'))) {
return;
}
if (!is_null($secondarySidebar->getChild('Support')->getChild('Knowledgebase'))) {
$secondarySidebar->getChild('Support')
->getChild('Knowledgebase')
->setURI('https://google.com');
}
});