Thank you! The redirection works. However, I still have a couple of issues that you might be able to help me with...
1) I still don't see the "Announcement" link/button show up on the top navigation bar for logged on users. It is hidden from the non-logged on users as expected. There are couple other hooks in place so I am not sure if they are all conflicting with each other.
Below are three different hooks I got so far... Pleaes let me know what I need to do to make the "Announcement" button show up on the top nav bar. Maybe something to do with the header template file?
<?php
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
if (!is_null($primaryNavbar->getChild('Support'))) {
$primaryNavbar->getChild('Support')->removeChild('Announcements');
$primaryNavbar->getChild('Support')->removeChild('Network Status');
$primaryNavbar->getChild('Support')->removeChild('Knowledgebase');
$primaryNavbar->getChild('Support')->removeChild('Downloads');
}
});
?>
<?php
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
if (!is_null($primaryNavbar->getChild('Network Status'))) {
$primaryNavbar->removeChild('Network Status');
}
if (!is_null($primaryNavbar->getChild('Announcements'))) {
$primaryNavbar->removeChild('Announcements');
}
if (!is_null($primaryNavbar->getChild('Knowledgebase'))) {
$primaryNavbar->removeChild('Knowledgebase');
}
if (!is_null($primaryNavbar->getChild('Contact Us'))) {
$primaryNavbar->removeChild('Contact Us');
}
});
?>
*******And, finally this below one from your previous post.*******
<?php
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
if (!is_null($primaryNavbar->getChild('Network Status'))) {
$primaryNavbar->removeChild('Network Status');
}
if (!is_null($primaryNavbar->getChild('Announcements'))) {
$primaryNavbar->removeChild('Announcements');
}
});
2) I published a test announcement and I see it listed under the "Recent News" box shown on the homepage of the Client Area. I hover over and it shows me the URL in the form of https://whmcs.domain.com/index.php/announcements/3/Test-Announcement.html . Clicking on it sure enough shows me the actual announcement and with your above hook visiting the above URL redirects to the login page. Now, the issue is if I click on the actual "Announcement" button anywhere within the Client Area it takes me to the page with the URL https://whmcs.domain.com/announcements.php and it shows the text "There are no announcements to display."
I am a bit confused with the above behavior. Why can't see the announcements when simply visiting the URL https://whmcs.domain.com/announcements.php instead of what appears to be a SEO friendly URL above?
Thank you again.