How to Hide the Menu for Non-Members in SocialEngine 4

Would you like to hide the main menu for non-members? If so, instead of hiding just a few things from non-members through the settings of each plugin, it’s better to just hide all! This way, non-members can only access portal page if set-up correctly. You can use this trick to do so:

Find: /application/modules/Core/widgets/menu-main/

Edit File: Controller.php

Find the following code:

class Core_Widget_MenuMainController extends Engine_Content_Widget_Abstract
{
  public function indexAction()
  {

    $this->view->navigation = $navigation = Engine_Api::_()
      ->getApi('menus', 'core')
      ->getNavigation('core_main');

    $this->view->viewer = $viewer = Engine_Api::_()->user()->getViewer();
    $require_check = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.general.browse', 1);
    if(!$require_check && !$viewer->getIdentity()){
      $navigation->removePage($navigation->findOneBy('route','user_general'));
    }
  }

  public function getCacheKey()
  {
    //return Engine_Api::_()->user()->getViewer()->getIdentity();
  }
}

Replace it with the following code:

class Core_Widget_MenuMainController extends Engine_Content_Widget_Abstract {   public function indexAction()   {     $this->view->navigation = $navigation = Engine_Api::_()       ->getApi(‘menus’, ‘core’)       ->getNavigation(‘core_main’);     $this->view->viewer = $viewer = Engine_Api::_()->user()->getViewer();     $require_check = Engine_Api::_()->getApi(‘settings’, ‘core’)->getSetting(‘core.general.browse’, 1);     if(!$require_check && !$viewer->getIdentity()){       $navigation->removePage($navigation->findOneBy(‘route’,’user_general’));     }         if( !$viewer->getIdentity() ) {                 return $this->setNoRender();         }   }   public function getCacheKey()   {     //return Engine_Api::_()->user()->getViewer()->getIdentity();   } }

THAT’S IT! :D I Hope this works well for you as it has me.

Looking for quality SocialEngine Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , | Posted under 3rd Party Software, SocialEngine | RSS 2.0

Author Spotlight

Andrew Cross

Andrew Cross

Hi, I'm Andrew. A am a 25, ICT Administrator which offers support to company's around the South Wales Area. I have created a few social sites for myself and other company's. So far 2 out of 3 have been successful using the powerful SocialEngine Script. I continue to try and help the community of SocialEngine by giving Support and Technical Help where possible.

One Comment on How to Hide the Menu for Non-Members in SocialEngine 4

  1. i read your article and loave it so much ,thank you so much.

Leave a Reply

Your email address will not be published. Required fields are marked *


− 1 = 7

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>