0

I wanted to delete an admin user programmatically, I have only FTP access.

3
  • when faced with issues like this, try to simulate the actions in the admin controller. If you take a look in Mage_Adminhtml_Permissions_UserController::deleteAction() you will find a code similar to what @SanderMangel posted as an answer.
    – Marius
    Oct 2, 2013 at 7:09
  • While trying to delete an admin user, just be careful to not delete admin user id 0. Oct 3, 2013 at 2:51
  • Hey Nived, can you post the error you've received on the BE? Oct 7, 2013 at 8:36

1 Answer 1

3

Although untested it stands to reason that you can use the normal Magento flow like with all models

Mage::getModel('admin/user')->load('user id')->delete();

But again, I didn't test it.

3
  • I tried the above code, not working, now I am not able to access admin, getting an error.
    – Nived
    Oct 2, 2013 at 7:32
  • 1
    Please update your answer with the error thrown and also explain how you executed this code. Oct 2, 2013 at 7:33
  • Confirmed, this method works. My code: $model = Mage::getModel('admin/user'); $user = $model->loadByUsername($username); $user->delete();
    – Pronto
    Aug 25, 2014 at 9:09

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.