Jump to content

Need help in six theme sidebar customization.


rabijit

Recommended Posts

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.

Link to comment
Share on other sites

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',
));
});

Link to comment
Share on other sites

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