Add a Sidebar Item

You can customize the Client Area’s sidebar navigation menus through hooks and custom modules.

For more information, see Client Area Sidebars and our Developer Documentation.

Add a Sidebar Menu Item

Before adding an item to a sidebar menu, check that the sidebar exists on that specific page. You can then add more menu items using the following example code:

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) {
    if (!is_null($primarySidebar->getChild('My Account'))) {
        $primarySidebar->getChild('My Account')
            ->addChild('Mailing List Subscription Prefs')
            ->setLabel('Subscription Preferences')
            ->setUri('subscriptionprefs.php')
            ->setIcon('fa-user')
            ->setOrder(100);
    }
});

Last modified: June 14, 2024