diff --git a/includes/class-reuna-mailchimp.php b/includes/class-reuna-mailchimp.php index e760384..efd8681 100644 --- a/includes/class-reuna-mailchimp.php +++ b/includes/class-reuna-mailchimp.php @@ -172,7 +172,7 @@ class Reuna_Mailchimp { $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); $this->loader->add_action( 'rest_api_init', $plugin_public, 'register_rest_api_routes' ); - $this->loader->add_action( 'user_register', $plugin_public, 'create_subscriber' ); + $this->loader->add_action( 'user_register', $plugin_public, 'handle_user_register' ); } diff --git a/public/class-reuna-mailchimp-public.php b/public/class-reuna-mailchimp-public.php index cc8f423..78fae55 100644 --- a/public/class-reuna-mailchimp-public.php +++ b/public/class-reuna-mailchimp-public.php @@ -109,6 +109,21 @@ class Reuna_Mailchimp_Public { ]); } + /** + * Subscribe user on registration + * + * @since 1.1.0 + */ + public function handle_user_register(int $user_id) + { + try { + $this->create_subscriber($user_id); + } + catch (\Exception $exception) { + // TODO: log the exception + } + } + /** * Handle the REST API Request *