load(); /* CRM */ define('CRM_ENDPOINT', $_ENV['CRM_ENDPOINT']); define('CRM_TOKEN', $_ENV['CRM_TOKEN']); define('CRM_PASSWORD', $_ENV['CRM_PASSWORD']); $callOK = false; $modelNotFound = false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended if (isset($_GET['hashcode']) and !empty($_GET['hashcode'])) { // * Initialise CRM API new CrmApiV2(CRM_ENDPOINT, CRM_TOKEN, CRM_PASSWORD); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $hashcode = filter_var($_GET['hashcode'], FILTER_SANITIZE_STRING); // Seul customer est géré pas single optin (pas d'envoi de news à ceux-ci) try { // ? Le customer exists ? Il est optin ? if (($customer = Customer::find($hashcode)) and $customer->opt_in) { // * Il met son optin à false $customer->toggleOptin(); $callOK = true; } else { $modelNotFound = true; } } catch (CrmException | ApiErrorException $e) { if (get_class($e) === ApiErrorException::class and $e->getApiError()->equals(ApiError::modelNotFound())) { $modelNotFound = true; } else { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log,Squiz.PHP.DiscouragedFunctions.Found error_log(sprintf( 'ERROR CRM API : %s - %s | hashcode : %s', (get_class($e) === CrmException::class ? $e->getMessage() : $e->getApiError()->label), $e->getMessage(), $hashcode )); } } } ?>
Vous êtes désinscris de la newsletter Réghalal.
En espérant vous revoir bientôt !
Une erreur est survenue.
Veuillez réessayer ultérieurement.