customer-activation icon indicating copy to clipboard operation
customer-activation copied to clipboard

How to change in file: Data.php code: Default Activation Status Group to: not active after registration?

Open J-dsgn opened this issue 5 years ago • 1 comments

Hi,

After registration user customer group Company default is automaticly activated, can use account and can see/order products with special prices which only set for this group without manually activation approvement by administrator ..

.. while there is set in Customer Activation extension that registration first must be activated by administrator before user customer group Company can loggin, use account or see/order products with special prices only set for this group.

Strange is also that in Magento backend the registration from customer group Company status is shown Customer Activated status: No.

While after registration for this group directly automaticly the account is active and usable ?!

Now I noticed in the Customer Registration extension in file:

Data.php

Path:

app/code/community/Netzarbeiter/CustomerActivation/Helper/Data.php

Following code snippet:

    /**
     * Return the default activation status for a given group and store Id
     *
     * @param int $groupId
     * @param int $storeId
     * @return bool
     */
    public function getDefaultActivationStatus($groupId, $storeId)
    {
        $defaultIsActive = Mage::getStoreConfig(self::XML_PATH_DEFAULT_STATUS, $storeId);
        $activateByGroup = Mage::getStoreConfig(self::XML_PATH_DEFAULT_STATUS_BY_GROUP, $storeId);
        
        if (! $defaultIsActive && $activateByGroup) {
            $notActiveGroups = explode(',', Mage::getStoreConfig(self::XML_PATH_DEFAULT_STATUS_GROUPS, $storeId));
            $isActive = in_array($groupId, $notActiveGroups) ? false : true;
        } else {
            $isActive = $defaultIsActive;
        }

        return $isActive;
    }
}

I am not a coder but as for as so far as I can see I assume the issue got to do with this code snippet line:

$isActive = in_array($groupId, $notActiveGroups) ? false : true;

If I read logical this code says actually:

Question:

Not activate groups?

Answer:

No!

Which means in other words also the same as:

Question:

activate groups?

Answer:

Yes!

From this I must simpy conclude that in practise this means that when user customer group Company registrate default it is automaticly activated in frontend.

Namely, when turn it around logically I would say the code snippet line should be something like this:

$isActive = in_array($groupId, $notActiveGroups) ? false : false;

But again, I am not a coder so forgive me and don't laugh too hard if it has nothing to do with the issue in my Mage shop please hehehe ;)))

Though if what I say makes any decent indeed:

How to adjust the code right to solve the issue in my shop?

Best regards,

Joris

J-dsgn avatar Mar 08 '19 14:03 J-dsgn

Hi, Unfortunately I can’t support this extension any more, both because I have not worked on a Magento 1 instance in more than 2 years and because my time is too limited.

Best of luck!

Vinai avatar Mar 11 '19 07:03 Vinai