Jump to content

Hiding part of ClientAreaPrimarySidebar for contacts


Recommended Posts

Hi

 

I want to hide the 'Client Details' part of the 'ClientAreaPrimarySidebar' but only for sub-account contacts, not for the main account owner.

 

How would I achieve this for logged in contacts? I know I can achieve it for the main account owner by following what's here: https://forum.whmcs.com/showthread.php?111958-How-hide-client-details-sidebar-in-client-area but I don't wish to do that.

 

Thanks

Link to comment
Share on other sites

I want to hide the 'Client Details' part of the 'ClientAreaPrimarySidebar' but only for sub-account contacts, not for the main account owner.

How would I achieve this for logged in contacts? I know I can achieve it for the main account owner by following what's here: https://forum.whmcs.com/showthread.php?111958-How-hide-client-details-sidebar-in-client-area but I don't wish to do that.

so as per the above thread, to hide the Clients Details sidebar for everyone, you would use...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) 
{
   if (!is_null($primarySidebar->getChild('Client Details'))) {
                   $primarySidebar->removeChild('Client Details');                
   }
});

but to do what you want to do and hide it from subaccounts only, i'd suggest using this...

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
   GLOBAL $smarty;
   $contactid = $smarty->getVariable('loggedinuser')->value['contactid'];

   if ($contactid && !is_null($primarySidebar->getChild('Client Details'))) {
                   $primarySidebar->removeChild('Client Details');
   }
});

Link to comment
Share on other sites

  • 7 years later...
  • 2 weeks later...

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