From d40cb941c0e88320c1c0bf30c4108ab938b190c1 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Mon, 19 May 2025 16:19:23 +0300 Subject: [PATCH] Refactor deactivation logic to unschedule additional actions Made the `deactivation` method public and added calls to unschedule specific actions related to email dispatch and account status checks. This ensures proper cleanup of scheduled tasks during plugin deactivation. --- includes/class-init.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/class-init.php b/includes/class-init.php index 36862a92..07138629 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -370,16 +370,18 @@ if ( ! class_exists( 'UM' ) ) { } } - /** * Plugin Deactivation * * @since 2.3 */ - function deactivation() { + public function deactivation() { $this->cron()->unschedule_events(); - } + $this->maybe_action_scheduler()->unschedule_all_actions( 'um_dispatch_email' ); + $this->maybe_action_scheduler()->unschedule_all_actions( 'um_schedule_empty_account_status_check' ); + $this->maybe_action_scheduler()->unschedule_all_actions( 'um_set_default_account_status' ); + } /** * Maybe need multisite activation process