Comments (6)

  1. # Ensure we are in the admin session namespace for checking the admin user..
    Mage::getSingleton('core/session', array('name' => 'adminhtml'))->start();
     
    $admin_logged_in = Mage::getSingleton('admin/session', array('name' => 'adminhtml'))->isLoggedIn();
     
    # ..get back to the original.
    Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();
  2. Is there any way to get a block on the frontend that could check if the user is logged into the admin? My only idea is to wrap it in an iframe with a custom controller that extends Mage_Adminhtml_Controller_Action — but I’d rather not use an iframe if I don’t have to…

  3. Make sure that your module’s adminhtml controller is extending Mage_Adminhtml_Controller_Action. You can’t check if an admin is logged in from a front end controller.

  4. Make sure that your module’s adminhtml controller is extending Mage_Adminhtml_Controller_Action. You can’t check if an admin is logged in from a front end controller.

  5. Hello, thanks for this code.
    I tried to implement it in frontend, but it return always the message “You need to be logged in as an admin.” Any help?

  6. Andreamweaver

    Hi, thanks for this snipped.
    I tried to put the code in my header.phtml but it return always “You need to be logged in as an admin.” even if I’m logged in the admin panel.
    What’s wrong? I’m running on Magento 1.5.

    Thank you

Leave a comment

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.