Jump to content

show sidebar based on customfield

Recommended Posts


can someone help me with just a simple Text Sidebar. 

I need a Hook which inserts a Sidebar to Client Area if i hit a Checkbox in Backend within Client. 

(Checkbox from Customfields) 


use WHMCS\View\Menu\Item as MenuItem;
// Add Sidebar Panel if Customer didn't signed Document.
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
    // IF Customfield is AKTIV then Hide, otherwise show following Sidebar. 
    $client_custom_filed_name = 'av-checkbox';
    $clientid = $clientobj->userid;

    // Get Client Details
    $clientdata = Capsule::table('tblcustomfieldsvalues')
    ->join('tblcustomfields', 'tblcustomfields.id', '=', 'tblcustomfieldsvalues.fieldid')
    ->where('tblcustomfields.fieldname', '=', $client_custom_filed_name)
    ->where('tblcustomfields.type', '=', 'client')
    ->where('tblcustomfieldsvalues.relid', '=', $clientid)

    if ($clientdata->value == 'off') {
    // Add a panel to secondary sidebar
    $secondarySidebar->addChild('av-contract', array(
        'label' => 'CustomTitel',
        'uri' => '#',
        'icon' => 'fa-file-contract',
    // Retrieve the panel
    $customPanel = $secondarySidebar->getChild('av-contract');

    // Add a Link
    $customPanel->addChild('av-link', array(
        'label' => 'Linkname',
        'uri' => '',
        'icon' => 'fa-file-contract',


Any Idea? 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.


Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated