/**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     // members-only is enabled for store
     if ($this->config->isMembersOnlyStore()) {
         $customerSession = $this->getCustomerSession();
         // customer is not logged in
         if (!$customerSession->isLoggedIn()) {
             $this->handleGuestView();
         }
     }
     return parent::_toHtml();
 }
 /**
  * Determine if customer has been approved and log them out with a notice
  * if they have not yet been approved.
  * @param Varien_Event_Observer $observer
  */
 public function redirectLoginNotApproved(Varien_Event_Observer $observer)
 {
     $event = $observer->getEvent();
     // members-only is enabled for store
     if ($this->config->isMembersOnlyStore()) {
         /** @var Mage_Customer_Model_Customer $customer */
         $customer = $event->getCustomer();
         if (!$customer->getMemberApproved()) {
             $customerSession = $this->getCustomerSession();
             $customerSession->logout();
             $customerSession->renewSession();
             $this->helper->displayNotice('CUSTOMER_NOT_APPROVED');
         }
     }
 }
 /**
  * Determine if is guest view
  * @return bool
  */
 protected function isGuestView()
 {
     $customerSession = $this->getCustomerSession();
     return $this->config->isMembersOnlyStore() && !$customerSession->isLoggedIn();
 }