Doesnt seem to work.
When I keep the $redirect static like in your example, it's fine.
Soon as I make that into a variable it fails:
<?php
$aedit_just_domain = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $_SERVER['HTTP_HOST']);
$aedit_homepageurl = "http://www.". $aedit_just_domain ."/";
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
$redirect = $aedit_homepageurl;
if (!is_null($primaryNavbar->getChild('Home'))) {
$primaryNavbar->getChild('Home')
->setURI($redirect);
}
});
Because I use the multibrand addon, the only thing I really want is that it picks up the url in the address field like http://billing.mydomain.com/, replace "billing." with "www." so it becomes http://www.mydomain.com, then makes the home button link there.
Anyone else or maybe you again Brian! that can think of a solution?
Thanks again and thanks in advance!