How can I tell whether a Magento user is an administrator?
I'm using Magento 1.5, and I need to check whether the currently-logged-in user is an admin user.开发者_StackOverflow社区 I need to check this from the user end, because I need to do a process for members that depends on whether they're admin users or not.
Is this possible in Magento?
Mage::getSingleton('admin/session')->getUser();
or
Mage::app()->getStore()->isAdmin();
Try,
$admin = Mage::getModel('customer/session')->getAdmin();
if($admin->getId() != '') {//Admin is logged in}
Mage::getSingleton('adminhtml/session')->getUser();
精彩评论