Jump to content

Remove menu item clientarea navbar v.7.2 doesn't work


imes

Recommended Posts

Greetings,

 

I've been trying to create hooks to remove menu item using hooks, just like listed here : https://developers.whmcs.com/hooks-reference/client-area-interface/#clientareanavbars

However, it didn't seemed like the hook even got triggered at all (none listed in activity log on my whmcs too), no error thrown on my php error log or apache error log.)

I'm using whmcs version 7.2.

Here is my code, i put it on mywhmcs/includes/hooks/

 

<?php
use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaNavbars', 1, function ()
{

        file_put_contents('../debug.txt', 'test text');
        // Get the current navigation bars.
    $primaryNavbar = Menu::primaryNavbar();
    $secondaryNavbar = Menu::secondaryNavbar();
    $children = $primaryNavbar->getChildren();
    if (!is_null($children)) {
        foreach ($children as $child) {
            $primaryNavbar->removeChild($child);
        }
    }

    $children = $secondaryNavbar->getChildren();
    if (!is_null($children)) {
        foreach ($children as $child) {
            $secondaryNavbar->removeChild($child);
        }
    }

});

?>

 

Any clues? Am i doing something wrong?

Any lead/help will be greatly appreciated

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