Jump to content

JokaUK

Member
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About JokaUK

  • Rank
    Junior Member
  1. Hello, The hook works and hides from the menu what I have in the array, but I noticed if the user puts for example #tabNameservers in the URL he can see and change the nameservers anyway. How can I block access from the URL as well? Regards
  2. Thank you for your help. I am not an expert and with your tips and searching I created this code and it works as expected. I don't know if it is the most correct way but the truth is that it works. Here is the code for anyone who wants. <?php use WHMCS\Database\Capsule; $data['children'] = array('Modify Nameservers', 'Registrar Lock Status', 'Auto Renew Settings', 'Domain Addons'); add_hook('ClientAreaPrimarySidebar', 1, function ($primarySidebar) use ($data) { $domain = Menu::context('domain'); $mydomain = $domain->domain; $sideBar = $primarySidebar->getChild('Domain Details Management'); $client = Menu::context('client'); $activeproduct = Capsule::table('tblhosting') ->where('userid',$client->id) ->where('domainstatus','Active') ->where('packageid','1')->pluck('domain'); if (count($activeproduct) > 0) { $activedomain = $activeproduct[0]; } else { $activedomain = ''; } if ($activedomain == $mydomain) { if ($sideBar) { foreach ($data['children'] as $child) { $sideBar->removeChild($child); } } } });
  3. Hello, I want to hide the "Nameservers" from the menu if a particular product is active. I'm using this hook, but it doesn't work. What am I doing wrong? <?php $data['packages'] = array('1'); // Array of Package IDs to be affected $data['children'] = array('Modify Nameservers'); // Array of Children to be removed add_hook('ClientAreaProductDetails', 1, function ($vars) use ($data) { $packageId = $vars['service']->packageId; if (in_array($packageId, $data['packages'])) { add_hook('ClientAreaPrimarySidebar', 1, function ($primarySidebar) use ($data) { $targetSidebar = $primarySidebar->getChild('Domain Details Management'); if ($targetSidebar) { foreach ($data['children'] as $child) { $targetSidebar->removeChild($child); } } }); } }); PS: The code works if it is something to hide on the product page menu, but hiding something on the domain page no longer works... Thanks for your help
×
×
  • 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