Jump to content

sidebars for logged in clients only


Recommended Posts

Using the code from v6 docs trying add social sidebar but once added it shows even when not logged in i want it only show if logged in.

 

I added code so it only shows on clientarea page but it also shows it on login page.

 

Anybody give me idea what to add to this hook code so it only shows if logged in.

 

<?php

use WHMCS\View\Menu\Item as MenuItem;



if (App::getCurrentFilename() == 'clientarea') {
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{

   $secondarySidebar->addChild('social-media', array(
       'label' => 'Social Media',
       'uri' => '#',
       'icon' => 'fa-thumbs-up',
   ));


   $socialMediaPanel = $secondarySidebar->getChild('social-media');


   $socialMediaPanel->moveToFront();


   $socialMediaPanel->addChild('facebook-link', array(
       'uri' => 'https://facebook.com/our-great-company',
       'label' => 'Like us on Facebook!',
       'order' => 1,
       'icon' => 'fa-facebook',
   ));


   $socialMediaPanel->addChild('twitter-link', array(
       'uri' => 'https://twitter.com/ourgreatcompany',
       'label' => 'Follow us on Twitter!',
       'order' => 2,
       'icon' => 'fa-twitter',
   ));


   $socialMediaPanel->addChild('google-plus-link', array(
       'uri' => 'https://plus.google.com/1234567890123456',
       'label' => 'Add us to your circles!',
       'order' => 3,
       'icon' => 'fa-google-plus',
   ));
});


}
add_hook("ClientAreaSecondarySidebar");

?>

Link to comment
Share on other sites

  • 6 months 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