Modify an Existing Panel

The customizable panels in the Client Area Homepage display quick information to clients when they log in. You can customize this part of the Client Area to suit your brand and your customers’ needs, including modifying the existing panels on the Homepage.

Modify an Existing Panel

You may want to change a link button and its text in a home panel (for example, to link to a third-party system).

Create the includes/hooks/recentTicketsPanel.php file in your WHMCS installation using the example below. WHMCS will parse the file and hook when the page loads and will run the hook function when the client visits the homepage after logging in.

Example Code

<?php

// This hook will adjust the button in the homepage panels. You have two
// different options of setExtra() or setExtras(). Use of setExtras() requires
// passing all 'extra' related vars through the array.

use WHMCS\View\Menu\Item;

add_hook('ClientAreaHomepagePanels', 1, function (Item $homePagePanels) {
    $recentTicketsPanel = $homePagePanels->getChild('Recent Support Tickets');

    if (!is_null($recentTicketsPanel)) {
        $recentTicketsPanel->setExtras(
            [
                'color' => 'amethyst',
                'btn-text' => 'New Name Here',
                'btn-link' => 'http://newlinkgoes.here',
                'btn-icon' => 'fa-thumbs-o-down',
            ]
        );
    }
});

Last modified: May 28, 2024