Jump to content

Neeed approvation of the new user registration


nasreddine hafidi

Recommended Posts

If you want to automatic disable the customer after the registrtaion and customer can only login after admin activate that customer from admin, then you can do that by adding the below code in "classes/form/CustomerForm.php" , submit()

Replace

try {
                $ok = $this->customerPersister->save(
                    $this->getCustomer(),
                    $clearTextPassword,
                    $newPassword,
                    $this->passwordRequired
                );
            } catch (PrestaShopException $e) {
                $this->errors[''][] = $this->translator->trans('Could not update your information, please check your data.', [], 'Shop.Notifications.Error');
                $ok = false;
            }

with

try {
                $ok = $this->customerPersister->save(
                    $this->getCustomer(),
                    $clearTextPassword,
                    $newPassword,
                    $this->passwordRequired
                );
                $emailField = $this->getField('email');
                $id_customer = Customer::customerExists($emailField->getValue(), true, true);
                $kb_customer_obj = new Customer($id_customer);
                $kb_customer_obj->active = 0;
                $kb_customer_obj->save();

            } catch (PrestaShopException $e) {
                $this->errors[''][] = $this->translator->trans('Could not update your information, please check your data.', [], 'Shop.Notifications.Error');
                $ok = false;
            }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...