user_email = $email; $user->user_login = $login; $this->blockNewUsers($errors, email_exists($email), $user); return $errors; } public function blockNewUsers(&$errors, $update, $user) { if ($update) return; $config = ConfigurationClass::getConfiguration(); $integrations = explode(',', $config->get('registration_integrations')); // The email verification is disabled in the configuration if (!in_array('cms', $integrations)) return; $conditions = $config->get('registration_conditions'); if (empty($conditions)) return; $testUser = new \stdClass(); $testUser->email = $user->user_email; $testUser->username = $user->user_login; if (empty($user->first_name) && empty($user->last_name)) { $testUser->name = $testUser->username; } else { $testUser->name = $user->first_name ?? ''; if (!empty($user->last_name)) { $testUser->name .= ' '.$user->last_name; } } $apiService = new ApiService(); $emailOk = $apiService->testUser($testUser, $conditions); if ($emailOk !== true) { if ($emailOk === 'blacklisted_name') { $errors->add('acyc_register_error', __('Please enter a valid name', 'acychecker')); } else { $errors->add('acyc_register_error', __('Invalid email address', 'acychecker')); } } } }