How to add admin user attributes in Magento

How to add admin user attributes in Magento

October 14, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to add admin user attributes in Magento

Adding Custom Attributes to Magento Admin Users

Managing admin users in Magento is a common requirement for e-commerce businesses. While you can currently set basic details like username, password, name, and email, you might want to add more attributes specific to your business needs. This guide will walk you through the process of adding new attributes to Magento admin users.

Finding the Admin User Attribute ID

Before we start, it’s important to note that unlike customer attributes which have a dedicated ‘customer’ ID, there is no direct way in Magento to find an equivalent ID for admin users. The admin user management is handled differently within the core system.

The admin_user table in your database contains all the necessary fields required for administrative users. You’ll notice columns like username, firstname, lastname, etc., which are sufficient for most basic admin user settings.

However, if you need to add custom fields, you can achieve this by creating new tables or extending existing ones. For example, let’s say you want to track the department each admin user belongs to:

CREATE TABLE admin_user_department
(
    id INT PRIMARY KEY,
    user_id INT NOT NULL,
    department VARCHAR(255),
    FOREIGN KEY (user_id) REFERENCES admin_user(user_id)
);

In this example, we’re creating a new table admin_user_department linked to the primary user_id in the admin_user table. This allows you to store additional information about each admin user.

Setting Up the New Attribute

To use this new department attribute, you’ll need to update your admin panel forms and codebase to include it:

  1. Update the User Form: In your Magento backend form for adding/editing users (usually located in app/code/core/Mage/Adminhtml/controllers/UserController.php), add a select dropdown for departments.

  2. Store the Data: When saving, you’ll need to insert this department data into the new table we created. Update your save function accordingly:

$department = $this->getRequest()->getParam('department');
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "INSERT INTO admin_user_department (user_id, department) VALUES (:user_id, :department)";
$binds = array(':user_id' => $userId, ':department' => $department);
$connection->query($sql, $binds);
  1. Update User Retrieval: To display this new data in your user list, update the function that retrieves admin users (usually in app/code/core/Mage/Adminhtml/Block/User.php):
$users = Mage::getModel('admin/user')->getCollection();
foreach ($users as $user) {
    // Fetch department from the new table
    $department = Mage::getSingleton('core/resource')->getConnection('core_read')
        ->fetchOne("SELECT department FROM admin_user_department WHERE user_id = " . $user->getId());

    // Display user data and department
}

Conclusion

While Magento does not provide a direct way to add attributes to admin users like customer attributes, you can achieve this by creating new tables and integrating them into your existing user management system.

By following the steps outlined above, you can create custom fields for your admin users, store them in the database, and use them throughout your application. Remember to test thoroughly after making these changes to ensure everything functions as expected.

This approach allows for a flexible way to extend Magento’s admin features without having to modify core files directly. For more advanced customizations or if you’re unsure about any part of the process, feel free to reach out to us at Laravel Company.

Happy coding!

Database Admin Configuration Email

Our network