1

I have created users from backend admin i.e. System->Permissions->Users . Now I want to obtain details of every users that are created. Can anyone please answer me how to obtain created user details?

1
  • What do you mean by "details"? Commented Dec 7, 2016 at 10:50

1 Answer 1

3

Try this- To get all user

$adminUserModel = Mage::getModel('admin/user');
$userCollection = $adminUserModel->getCollection()->load(); 
print_r($userCollection->getData());

To get all the Roles

   $roles = Mage::getModel('admin/roles')->getCollection();
   foreach($roles as $role):
      echo '<br/>Role : '.$role->getId()." | ".$role->getRoleName();
   endforeach;

To get the Role users

  $roles_users = Mage::getResourceModel('admin/roles_user_collection');
  foreach($roles_users as $roleuser):
   $user = Mage::getModel('admin/user')->load($roleuser->getUserId());
   echo '<br/>User : '.$user->getUsername()." | ".$user->getFirstname();
  endforeach;
4
  • Thanks Piyush. Can you please help me how to get Users details with specific role? Commented Dec 7, 2016 at 10:59
  • please check my updated answer
    – Piyush
    Commented Dec 7, 2016 at 11:05
  • Dear i want details of users created that have specific role. For example, All user details that have role id = '3' . Commented Dec 7, 2016 at 11:10
  • You have join user and role table Commented Dec 12, 2016 at 5:40

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.