Created
June 13, 2017 16:33
-
-
Save gelanivishal/89cffe858ed4fdac401f402075836437 to your computer and use it in GitHub Desktop.
M1 - Check admin logged in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isAdminLogin(){ | |
$userId = 0; | |
$switchSessionName = 'adminhtml'; | |
$currentSessionId = Mage::getSingleton('core/session')->getSessionId(); | |
$currentSessionName = Mage::getSingleton('core/session')->getSessionName(); | |
//if ($currentSessionId && $currentSessionName && isset($_COOKIE[$currentSessionName])) { | |
if(isset($_COOKIE[$switchSessionName])){ | |
$switchSessionId = $_COOKIE[$switchSessionName]; | |
$this->_switchSession($switchSessionName, $switchSessionId); | |
$user = Mage::getModel('admin/session')->getUser(); | |
if($user){ | |
$userId = Mage::getModel('admin/session')->getUser()->getId(); | |
} | |
$this->_switchSession($currentSessionName, $currentSessionId); | |
} | |
//} | |
return $userId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment