Jump to content

Adding an removing from menu


martinezfer

Recommended Posts

Hi,

I'm trying to remove and add some menu items to the WHMCS template through hooks. I was able to add some but following same php files, for some reason, some did not work.

Can someone advise what is wrong with these hook php files?

1-Adding "VPN" as submenu of "Hosting Main Menu"

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
    if (!is_null($primaryNavbar->getChild('Hosting'))) {
        $primaryNavbar->getChild('Hosting')
            ->addChild('VPN', array(
                'label' => 'VPN',
                'uri' => 'https://.......',
                'order' => '101',
            ));
    }
});


2-Remove "SSL Certificates" from submenu under "Store"

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
    if (!is_null($primaryNavbar->getChild('Store'))) {
        $primaryNavbar->getChild('Store')->removeChild('SSL Certificates');
    }
});

 

Please advise

Edited by martinezfer
Link to comment
Share on other sites

16 hours ago, martinezfer said:

1-Adding "VPN" as submenu of "Hosting Main Menu"

if the hosting menu exists (i'm assuming another hook is creating it?), then the hook should work... it's possible that if this hook is running before the hook that creates the hosting menu runs, then it might not appear to work... but then I wouldn't have multiple sepaarate hook files modifying the menu - i'd consolidate them as one hook (or at least one file) so you have some idea what changes are being made in the one place.

16 hours ago, martinezfer said:

2-Remove "SSL Certificates" from submenu under "Store"

in any recent version, I would expect the removeChild value to be 'symantec' instead of 'SSL Certificates'.

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