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

Written by Andrew Cross Wednesday, 5 December 2012

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!



1 Comment

  1. canada goose coats   |  Saturday, 15 December 2012 at 12:57 am

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

Leave a Reply






− two = 5