markcodes Posted October 29, 2015 Share Posted October 29, 2015 (edited) Hi all, I added a sidebar tab called "Port Forward" in the "Service Details Overview" primary sidebar with a link to a tab the same productdetails page. The added sidebar is connected to the productdetails page with an "id=tabPortForward". Problem is when I click on the tab (which is supposed to show me the tabPortforward tab on the page) the tab do not show up at all. Note that there is no error on WHMCS which I find. image: i.gyazo.com/fef4a3c5446c2200ad4c06a246a47c79.png hook code: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Service Details Overview'))) { $primarySidebar->getChild('Service Details Overview') ->addChild('PortForward', array( 'label' => 'Port Forwarding', 'uri' => '/clientarea.php?action=productdetails&id=' . $_GET['id'] . '#tabPortForward', 'order' => '100', ))->setClass(( ! isset($_GET['modop']) ? 'active' : '')); } }); productdetails.tpl added tab code: <div class="tab-pane fade in" id="tabPortForward"> <h3>{$LANG.portforwardtitle}</h3> </div> Anyone can show me the right direction so the #tabPortForward tab will show? Thank you all Edited October 29, 2015 by Infopro Please Attach Images to Your Posts. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 29, 2015 Share Posted October 29, 2015 I think the problem is that you need to add data-toggle="tab" to your link in the hook, but this is another one of those undocumented features. WHMCS knows how to do it because it's in their code (see the "Information" link in your sidebar), so unless sentq has the answer, i'd suggest opening a support ticket and asking WHMCS how it's done... and if they give you an answer, share it with the rest of us! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 29, 2015 Share Posted October 29, 2015 I think the problem is that you need to add data-toggle="tab" to your link in the hook, but this is another one of those undocumented features. WHMCS knows how to do it because it's in their code (see the "Information" link in your sidebar), so unless sentq has the answer, i'd suggest opening a support ticket and asking WHMCS how it's done... and if they give you an answer, share it with the rest of us! here is how to implement it <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Service Details Overview'))) { $primarySidebar->getChild('Service Details Overview')->addChild('PortForward', array( 'label' => 'Port Forwarding', 'uri' => '/clientarea.php?action=productdetails&id=' . $_GET['id'] . '#tabPortForward', 'order' => '100' ))->setClass(( ! isset($_GET['modop']) ? 'active' : '')) ->setAttribute("dataToggleTab", "tabPortForward"); } }); 0 Quote Link to comment Share on other sites More sharing options...
markcodes Posted October 29, 2015 Author Share Posted October 29, 2015 here is how to implement it <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Service Details Overview'))) { $primarySidebar->getChild('Service Details Overview')->addChild('PortForward', array( 'label' => 'Port Forwarding', 'uri' => '/clientarea.php?action=productdetails&id=' . $_GET['id'] . '#tabPortForward', 'order' => '100' ))->setClass(( ! isset($_GET['modop']) ? 'active' : '')) ->setAttribute("dataToggleTab", "tabPortForward"); } }); sentq you are the best! thank you! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 29, 2015 Share Posted October 29, 2015 sentq you are the best! thank you! you're welcome. just another undocumented feature 0 Quote Link to comment Share on other sites More sharing options...
markcodes Posted October 29, 2015 Author Share Posted October 29, 2015 you're welcome. just another undocumented feature One more thing please.. I don't want to show the sidebar menu "Port Forward" if $domainStatus != 'Active' How can I do that? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 29, 2015 Share Posted October 29, 2015 check this <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Service Details Overview'))) { $service = Menu::context('service'); if ($service->domainStatus==="Active"){ $primarySidebar->getChild('Service Details Overview')->addChild('PortForward', array( 'label' => 'Port Forwarding', 'uri' => '/clientarea.php?action=productdetails&id=' . $_GET['id'] . '#tabPortForward', 'order' => '100' ))->setClass(( ! isset($_GET['modop']) ? 'active' : '')) ->setAttribute("dataToggleTab", "tabPortForward"); } } }); 0 Quote Link to comment Share on other sites More sharing options...
markcodes Posted October 29, 2015 Author Share Posted October 29, 2015 One more thing please..I don't want to show the sidebar menu "Port Forward" if $domainStatus != 'Active' How can I do that? Sentq I got the code below: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $service = Menu::context("service"); $status = $service->domainStatus; if ($status==='Active'){ if (!is_null($primarySidebar->getChild('Service Details Overview'))) { $primarySidebar->getChild('Service Details Overview') ->addChild('PortForward', array( 'label' => 'Port Forwarding', 'uri' => '/clientarea.php?action=productdetails&id=' . $_GET['id'] . '#tabPortForward', 'order' => '100', ))->setAttribute("dataToggleTab", "tabPortForward"); } } }); maybe you can check if its correct. Its working as of my latest testing. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 29, 2015 Share Posted October 29, 2015 it will work, the same as mine above I tested it already 0 Quote Link to comment Share on other sites More sharing options...
markcodes Posted October 30, 2015 Author Share Posted October 30, 2015 it will work, the same as mine above I tested it already Thanks sentq your a legend! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 30, 2015 Share Posted October 30, 2015 here is how to implement it lol - nice one... I tried setAttribute... knew it should be the right one but couldn't get it to work.. tried linkattribute too... just another undocumented feature by the time we get all the options figured out, they'll move on to using something else! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 30, 2015 Share Posted October 30, 2015 lol - nice one... I tried setAttribute... knew it should be the right one but couldn't get it to work.. tried linkattribute too... I tried many things indeed to get the correct one by the time we get all the options figured out, they'll move on to using something else! Yes It's always like this 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted February 11, 2016 Share Posted February 11, 2016 This topic is excellent. I was looking for many of the things answered here. So thank you all !!! 0 Quote Link to comment Share on other sites More sharing options...
Quard Posted September 3, 2020 Share Posted September 3, 2020 The active not working 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.