Magento check if admin user logged in or not


Magento check if admin user logged in or not : While working with magento we sometimes need to decide whether user is logged from front end or admin. Mage::getSingleton(‘core/session’, array(‘name’ => ‘adminhtml’)); is used to get the admin end logged in user session. Here in this tutorial we are going to explain how you can check the customer login on magento backend ie admin.


Magento check if admin user logged in or not

You can check the customer is logged in simply as below –

Magento check if admin user logged in or not:


Mage::getSingleton('core/session', array('name' => 'adminhtml'));

$userSession = Mage::getSingleton("customer/session");

if($userSession->isLoggedIn()) {
  echo "Is Logged In from Admin";
} else {
   echo "User Not Logged on Admin";
}

Using the above method you can check that the user is logged in from admin or not.


User Ans/Comments

📖 Read More


    Advertisements