Vinai / customer-activation

Magento extension which makes it impossible for a customer to log in until the account has been activated by the administrator.
120 stars 59 forks source link

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

Open J-dsgn opened 5 years ago

J-dsgn commented 5 years ago

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

Vinai commented 5 years ago

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!