4

I have created new user from admin > permission > user .

Now I want to get current user permission role

 $roleId = Mage::getSingleton('customer/session')->getCustomerGroupId();
 $role = Mage::getSingleton('customer/group')->load($roleId)->getData('customer_group_code');
 $role = strtolower($role);

but its now working

1
  • I tried that code snippet and it's working. What do you mean by 'not working'?
    – Laura
    Commented Feb 18, 2015 at 21:12

1 Answer 1

13

Not sure if I understand your question, but it seem as you created an "admin user" and not a "customer".

To get an admin user role try (assuming that user is log in)

$admin_user_session = Mage::getSingleton('admin/session');
$adminuserId = $admin_user_session->getUser()->getUserId();
$role_data = Mage::getModel('admin/user')->load($adminuserId)->getRole()->getData();

See Magento: How to get user role from user id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.