4
votes

I'm using Magento 1.5, and I need to check whether the currently-logged-in user is an admin user. 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?

3
More details would help, the question is semi-vague. - B00MER
Sometimes it will be impossible because of cookie security. If the admin and store are on different domains, or (more likely) the admin is secured and the frontend is not, the admin session could be inaccessible from the frontend. - clockworkgeek

3 Answers

4
votes
Mage::getSingleton('admin/session')->getUser();

or

Mage::app()->getStore()->isAdmin();
1
votes

Try,

$admin = Mage::getModel('customer/session')->getAdmin();
if($admin->getId() != '') {//Admin is logged in}
1
votes
Mage::getSingleton('adminhtml/session')->getUser();