I need to change the role of the user in case the user fills up all the required details from limited to the administrator. However, I need this to be done programmatically so please guide me the way I can make this possible.

2 Answers 2


Try This:

$userId = 2;
$userModel = Mage::getModel('admin/user')->load($userId);
$userModel->setRoleIds(array(2,3,12)) //Role ids array()

This code is for you:

      $role = Mage::getModel("admin/role");
      $role->setParent_id(5); //This is role id
      $role->setUser_id($user_id); //user id that role need to change

Your Answer

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

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