php - Magento : How to check if admin is logged in within a module controller? -


i'm creating magento module. within controller, want check if admin logged in or not. controller accessible if there logged in admin.

i'm trying use code on controller.

mage::getsingleton('core/session', array('name' => 'adminhtml'));  $session = mage::getsingleton('admin/session');  // use 'admin/session' object check loggedin status if ( $session->isloggedin() ) {    echo "logged in"; } else {    echo "not logged in"; } 

but "not logged in", if i'm logged in magento admin.

can me resolve issue?? appreciated. thanks

that strange. use same code , works time:

//get admin session mage::getsingleton('core/session', array('name'=>'adminhtml'));  //verify if user logged in backend if(mage::getsingleton('admin/session')->isloggedin()){   //do stuff } else {   echo "go away bad boy"; } 

did try var_dumping $session variable? maybe on right track...


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -