Jump to content

Navigation Var in WHMCS for logged user issue - NEED help


rezabagh

Recommended Posts

hello

 

i use the bellow hook for adding a menu when user is not logged in , and it works fine , but now i need a hook to add a menu for users which are logged in , how should i edit this hook to get the result ?

 

NEED your help

 

Thanks

 

<?php

#adding Menu Item to primaryNavbar

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)

{

$client = Menu::context('client');

 

// only add menu item when no client logged in

if (is_null($client)) {

$primaryNavbar->addChild('test')

->setUri('test.php')

->setOrder(10);

}

});

Link to comment
Share on other sites

if the user is not logged in, the hook below will create a "test" navbar item; if they are logged in, it will show "test2"...

 

<?php
#adding Menu Item to primaryNavbar
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
$client = Menu::context('client');

// only add menu item when no client logged in
if (is_null($client)) {
$primaryNavbar->addChild('test')
->setUri('test.php')
->setOrder(10);
}

// only add menu item when client logged in
if (!is_null($client)) {
$primaryNavbar->addChild('test2')
->setUri('test2.php')
->setOrder(10);
}
}); 

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