Sankar Subburaj
Sankar Subburaj

Reputation: 5042

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. 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?

Upvotes: 4

Views: 4475

Answers (3)

Sankar Subburaj
Sankar Subburaj

Reputation: 5042

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

or

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

Upvotes: 3

Stephan Hoyer
Stephan Hoyer

Reputation: 4928

Mage::getSingleton('adminhtml/session')->getUser();

Upvotes: 1

Nasaralla
Nasaralla

Reputation: 1839

Try,

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

Upvotes: 1

Related Questions