Magento客户激活模块破解了客户群

I installed a free extension that requires admin approval before a customer can log in. I am hacking it to try to get it to allow all customer groups except for one. I think the following is the function that I would edit, but when I do a test registration the test cookie does not show up in my console. Any ideas?

/**
     * Flag new accounts as such
     *
     * @param Varien_Event_Observer $observer
     */
    public function customerSaveBefore($observer)
    {
        $customer = $observer->getEvent()->getCustomer();

        $storeId = Mage::helper('customeractivation')->getCustomerStoreId($customer);
        $session = Mage::getSingleton('customer/session'); // var $session Mage_Customer_Model_Session
$customer_info = $session->getCustomer(); // var $customer Mage_Customer_Model_Customer
$userinfo = $customer_info->_origData; // fetch users info

// get user's customer group id number
$customer_group = $userinfo['group_id']; 
setcookie("Group", "yes");

        if (Mage::getStoreConfig(self::XML_PATH_MODULE_DISABLED, $storeId))
        {
            return;
        }

        if (!$customer->getId())
        {
            $defaultStatus = Mage::getStoreConfig(self::XML_PATH_DEFAULT_STATUS, $storeId);
            $customer->setCustomerActivated($defaultStatus);
            $customer->setCustomerActivationNewAccount(true);
        }
    }

My code is the:

$customer_info = $session->getCustomer(); // var $customer Mage_Customer_Model_Customer
$userinfo = $customer_info->_origData; // fetch users info

// get user's customer group id number
$customer_group = $userinfo['group_id']; 
setcookie("Group", "yes");

First: Please don't try to hack the module. Better create your own module rewriting the classes of the original module, so you'll still be able to update the original one.

Second: Are you sure that part of code is executed? What happens if you enter a die() in it?

Third: You can see a list of all triggered event by implementing the firegento-debug module, so you could check if that event is really fired and the observer called.

Hi i was customizing the same extension.

The thing is your are not getting the customer group.

try this line for getting the customer group

$customer = $observer->getEvent()->getCustomer();

$groupId = $customer->getGroupId();