I need to add a custom field to the user account information while creating a user under
system > permission > user > add new user
I need to add a "location" field along with firstname, lastname, email and password fields.
how can I do this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
1- This tutorial may help you, it does exact the same thing you want but just for customer account Add Custom Field to Customer Address
2- Another rough method is that you override the magento core files,
and add your desired field
and then goto database
admin_user table and add that field there
You will need to add a column to the
$installer->getConnection()->addColumn($installer->getTable('admin/user'), 'location', array( 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'length' => 256, 'nullable' => true, 'default' => null ));
Then, if you want to add/edit this field from the backend you need to rewrite the method
Mage_Adminhtml_Block_Permissions_User_Edit_Tab_Main::_prepareForm and add a new element in there:
$fieldset->addField('location', 'select', array( 'name' => 'is_active', 'label' => Mage::helper('adminhtml')->__('location'), 'id' => 'is_active', 'title' => Mage::helper('adminhtml')->__('location'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => Mage::helper('adminhtml')->__('Yes'), '0' => Mage::helper('adminhtml')->__('No')), ));
Clear the cache and it should work.