I need to add a field that I did to the customer, but also to the admin user. I have the customer one working,
$installer->addAttribute('customer', 'ldap_user', array(
'type' => 'int',
'input' => 'select',
'source' => 'eav/entity_attribute_source_boolean',
'label' => 'Has AD account',
'visible' => true,
'required' => false,
));
$attr = Mage::getSingleton( 'eav/config' )->getAttribute( 'customer', 'ldap_user' );
$attr->setData( 'used_in_forms', array( 'adminhtml_customer' ) );
$attr->save();
But I can't seem to find anything on how to do one for the admin user and all attempts so far to convert this to the admin/user
model has failed. Any ideas on the correct way to add this field?
*UPDATE Base on @Marius answer I'm closer. The install part works, and the column was added. The tab prepare Form is not yes right. I put
\app\code\local\Wsu\NetworkSecurities\Block\Adminhtml\Permissions\User\Edit\Tab\Main.php
<?php
class Wsu_NetworkSecurities_Block_Adminhtml_Permissions_User_Edit_Tab_Main extends Mage_Adminhtml_Block_Permissions_User_Edit_Tab_Main {
protected function _prepareForm() {
parent::_prepareForm();
$form = $this->getForm();
$fieldset = $form->getElements()->searchById('user_base_fieldset');
$fieldset->addField('ldap_user', 'select', array(
'name' => 'is_active',
'label' => Mage::helper('adminhtml')->__('LDAP user'),
'id' => 'is_active',
'title' => Mage::helper('adminhtml')->__('LDAP user'),
'class' => 'input-select',
'style' => 'width: 80px',
'options' => array('1' => Mage::helper('adminhtml')->__('Yes'), '0' => Mage::helper('adminhtml')->__('No')),
));
$this->setForm($form);
return $this;
}
}
But I am not seeing it. I can see also I think I need to rewrite system_account/index
too I would think?
/etc/config.xml
<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
<Wsu_NetworkSecurities>
<version>0.1.0</version>
</Wsu_NetworkSecurities>
</modules>
<global>
<blocks>
<wsu_networksecurities>
<class>Wsu_NetworkSecurities_Block</class>
</wsu_networksecurities>
<adminhtml>
<rewrite>
<permissions_user_edit_tab_main>Wsu_NetworkSecurities_Block_Adminhtml_Permissions_User_Edit_Tab_Main</permissions_user_edit_tab_main>
</rewrite>
</adminhtml>
</blocks>
</global>
</config>
That is what I have for the blocks.
UPDATE
So this works to add a new fieldset and add the field, but it never could get in the main fieldset, but it works.
protected function _prepareForm() {
parent::_prepareForm();
$form = $this->getForm();
$fieldset = $form->addFieldset('LDAP', array(
'legend' => Mage::helper('adminhtml')->__('User Info'),
'class' => 'fieldset-wide'
));
$fieldset->addField('ldap_user', 'select', array(
'name' => 'is_active',
'label' => Mage::helper('adminhtml')->__('LDAP user'),
'id' => 'is_active',
'title' => Mage::helper('adminhtml')->__('LDAP user'),
'class' => 'input-select',
'style' => 'width: 80px',
'options' => array('1' => Mage::helper('adminhtml')->__('Yes'), '0' => Mage::helper('adminhtml')->__('No')),
));
return $this;
}
}