Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to make customer inactive and active
 
Vinay.N ( Tumkur,Kethohalli)
Jr. Member
 
Total Posts:  6
Joined:  2009-02-13
 

1) Create a drop down list similar to admin users which has an option of making admin users active and inactive

INSERT INTO `magentook`.`eav_attribute` (
`entity_type_id` ,
`attribute_code` ,
`attribute_model` ,
`backend_model` ,
`backend_type` ,
`backend_table` ,
`frontend_model` ,
`frontend_input` ,
`frontend_label` ,
`frontend_class` ,
`source_model` ,
`is_global` ,
`is_visible` ,
`is_required` ,
`is_user_defined` ,
`default_value` ,
`is_searchable` ,
`is_filterable` ,
`is_comparable` ,
`is_visible_on_front` ,
`is_unique` ,
`is_configurable` ,
`apply_to` ,
`position` ,
`note` ,
`is_visible_in_advanced_search` ,
`is_used_for_price_rules`
)
VALUES (
‘1’, ‘is_activevarchar’, NULL , ‘’, ‘varchar’, ‘’, ‘’, ‘select’, ‘Is Active’, NULL , ‘eav/entity_attribute_source_boolean’, ‘0’, ‘1’, ‘0’, ‘0’, ‘’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘1’, ‘’, ‘1’, ‘’, ‘0’, ‘1’
)

2) There is a function called validatePassword($password) in
Path : magento\app\code\core\Mage\Customer\Model\customer.php
public function validatePassword($password)
{
//To check whether the user is active or not
if($this->getData("is_activevarchar")=="0")
{
//to show the error message that the user is made inactive by admin
$_SESSION["cw_is_active"]="0";
return false;
}
if (!($hash = $this->getPasswordHash())) {
return false;
}
return Mage::helper(’core’)->validateHash($password, $hash);
}

3) This is required to make the the drop down list by default to “Yes”

Path : app\code\core\Mage\Eav\Model\Entity\Attribute\Frontend\Abstract.php

public function getValue(Varien_Object $object)
{
$value = $object->getData($this->getAttribute()->getAttributeCode());
if (in_array($this->getConfigField(’input’), array(’select’,’boolean’))) {
$valueOption = $this->getOption($value);
if (!$valueOption) {
$opt = new Mage_Eav_Model_Entity_Attribute_Source_Boolean();
if ($options = $opt->getAllOptions()) {
foreach ($options as $option) {
//this is required to make the the drop down list by default “Yes”
if (is_null($value))
{
if ($option[’value’] == 1 )
$valueOption = $option[’label’];
}
else if ($option[’value’] == $value ) {
$valueOption = $option[’label’];
}
}
}
}
$value = $valueOption;
}
elseif ($this->getConfigField(’input’)==’multiselect’) {
$value = $this->getOption($value);
if (is_array($value)) {
$value = implode(’,’, $value);
}
}
return $value;
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
vishalsanwar
Jr. Member
 
Total Posts:  27
Joined:  2011-05-30
 

HI

You can use folllwoing Extesnion for this.
Customer Activation : This small extension makes it impossible for a customer to log in to magento, until the account has been activated in the adminhtml interface: Customers > Manage Customers > (select customer) > Account Information > Is activated.
http://www.magentocommerce.com/magento-connect/vinai/extension/489/customer-activation

Thanks
Vishal

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top