rabijit Posted January 4, 2016 Share Posted January 4, 2016 I am customizing my client area using sidebar hooks. I successfully render the desired sidebar, but i want it to appear only for logged users. My sidebar code //////////////////////////// add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $PrimarySidebar) { $PrimarySidebar->addChild('dashboard', array( 'label' => 'Quick Links', 'uri' => '#', 'icon' => 'fa-bars', 'order'=> 1, )); $dashboardPanel = $PrimarySidebar->getChild('dashboard'); $dashboardPanel->addChild('Dashboard', array( 'uri' => 'clientarea.php', 'label' => 'Dashboard', 'order' => 1, 'icon' => 'fa-tachometer', )); $dashboardPanel->addChild('My Services', array( 'uri' => 'clientarea.php?action=services', 'label' => 'My Services', 'order' => 2, 'icon' => 'fa-server', )); $dashboardPanel->addChild('My Domains', array( 'uri' => 'clientarea.php?action=domains', 'label' => 'My Domains', 'order' => 3, 'icon' => 'fa-globe', )); }); ////////////////////////////////////////////////// This sidebar rendered for logged and non logged users, i want it for logged user only. Thanks in advance. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted January 4, 2016 Share Posted January 4, 2016 try it this way add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $PrimarySidebar) { if (intval($_SESSION['uid'])==0){ return; } $PrimarySidebar->addChild('dashboard', array( 'label' => 'Quick Links', 'uri' => '#', 'icon' => 'fa-bars', 'order'=> 1, )); $dashboardPanel = $PrimarySidebar->getChild('dashboard'); $dashboardPanel->addChild('Dashboard', array( 'uri' => 'clientarea.php', 'label' => 'Dashboard', 'order' => 1, 'icon' => 'fa-tachometer', )); $dashboardPanel->addChild('My Services', array( 'uri' => 'clientarea.php?action=services', 'label' => 'My Services', 'order' => 2, 'icon' => 'fa-server', )); $dashboardPanel->addChild('My Domains', array( 'uri' => 'clientarea.php?action=domains', 'label' => 'My Domains', 'order' => 3, 'icon' => 'fa-globe', )); }); 0 Quote Link to comment Share on other sites More sharing options...
rabijit Posted January 4, 2016 Author Share Posted January 4, 2016 Thanks it works. 0 Quote Link to comment Share on other sites More sharing options...
rabijit Posted January 7, 2016 Author Share Posted January 7, 2016 hi thanks again for reply but got another issue, how to remove the sidebar from domainchecker page while user logged in ? 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.