Jump to content

Editing navbar links when logged out


mezzo

Recommended Posts

I can edit the navbar links but it only shows when the client is logged in. When logged, the links point at default.

 

 { 
   $navItem = $primaryNavbar->getChild('Open Ticket'); 
   if (is_null($navItem)) { 
       return; 
   } 


   $navItem->setUri('https://www.test.com/contact/'); 

   }  

 

Where, or how, do I add a hook to make it so that a link points where I want, when the client is logged out?

 

I appreciate any help in advance.

Edited by mezzo
Link to comment
Share on other sites

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   $navItem = $primaryNavbar->getChild('Contact Us');
   if (is_null($navItem)) {
       return;
   }



   $navItem->setUri('https://www.example.com');

});
add_hook("ClientAreaPrimaryNavbar");

?>

 

should do it for you.

Edited by lee-wservices
Link to comment
Share on other sites

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   $navItem = $primaryNavbar->addChild('Open Ticket');
   if (is_null($navItem)) {
       return;
   }



   $navItem->setUri('https://www.example.com')
    ->setOrder(100);                           ;

});
add_hook("ClientAreaPrimaryNavbar");

?>

 

No it was the getchild i thought you was trying to change the wrong one this one adds the open ticket to logged out

Edited by lee-wservices
Link to comment
Share on other sites

can't delete posts for some reason..

 

- - - Updated - - -

 

 

No it was the getchild i thought you was trying to change the wrong one this one adds the open ticket to logged out

 

Right, this works.. but I'm trying to change a existing menu item, not add a new one..

Edited by mezzo
Link to comment
Share on other sites

Okay, so the "Open Ticket" assumes that it will only be used for clients logged in. I believe I understand it now, I want to remove the 'Open Ticket' and just create a fresh new 'Contact Us'.

 

Same goes for the "Announcements" too I guess.. WHMCS just assumes that this is only going to be used for logged-in clients I guess.

 

THANK YOU SO MUCH for your time today! I'm following you on Twitter now, and may employ your services down the road. You made me very happy today.

Link to comment
Share on other sites

Yes its Open Ticket inside Contact Us On the outside so keep the one you did that works inside and use the first one i posted to change the Contact Us link on the outside To change Announcements On outside change the Contact Us To Announcements in the first one i posted that should get them done for you.

 

Your welcome and i will follow you back.

Link to comment
Share on other sites

  • 5 years later...
On 7/24/2015 at 12:44 AM, lee-wservices said:

 


<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   $navItem = $primaryNavbar->addChild('Open Ticket');
   if (is_null($navItem)) {
       return;
   }



   $navItem->setUri('https://www.example.com')
    ->setOrder(100);                           ;

});
add_hook("ClientAreaPrimaryNavbar");

?>
 

 

 

No it was the getchild i thought you was trying to change the wrong one this one adds the open ticket to logged out

THANKS THIS WORKS FOR ME

Link to comment
Share on other sites

  • 2 months later...
On 7/24/2015 at 12:44 AM, lee-wservices said:

 


<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   $navItem = $primaryNavbar->addChild('Open Ticket');
   if (is_null($navItem)) {
       return;
   }



   $navItem->setUri('https://www.example.com')
    ->setOrder(100);                           ;

});
add_hook("ClientAreaPrimaryNavbar");

?>
 

 

 

No it was the getchild i thought you was trying to change the wrong one this one adds the open ticket to logged out

Now when i have to change the link of sidebar nav item it doesn't work, 

Please tell me how to edit the link of this item shown on screenshot "Open Ticket" item.

Thanks in advance.

Screenshot of Clients Portal - Web Hosting-Email Hosting-Cloud Hosting.jpg

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