From 2d3ce07b9bf2e6ee8d639233b14f3bf47bce3a89 Mon Sep 17 00:00:00 2001 From: Aunshon <32583103+Aunshon@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:45:38 +0600 Subject: [PATCH 1/4] Add notice for version compatibility. --- includes/Admin/Notices/Manager.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/includes/Admin/Notices/Manager.php b/includes/Admin/Notices/Manager.php index 7a9251d9a6..18671af0d2 100644 --- a/includes/Admin/Notices/Manager.php +++ b/includes/Admin/Notices/Manager.php @@ -50,6 +50,7 @@ private function init_hooks() { add_filter( 'dokan_admin_notices', [ $this, 'show_permalink_setting_notice' ] ); add_filter( 'dokan_admin_notices', [ $this, 'show_admin_logo_update_notice' ] ); add_action( 'wp_ajax_dismiss_dokan_admin_logo_update_notice', [ $this, 'dismiss_dokan_admin_logo_update_notice' ] ); + add_filter( 'dokan_admin_notices', [ $this, 'show_admin_commission_notice' ] ); } /** @@ -189,4 +190,23 @@ private function dismiss_notice( string $option_name ) { update_option( $option_name, 'yes' ); wp_send_json_success(); } + + public function show_admin_commission_notice( $notices ) { + if ( + version_compare( DOKAN_PLUGIN_VERSION, '3.14.0', '>=' ) && + defined( 'DOKAN_PRO_PLUGIN_VERSION' ) && + version_compare( DOKAN_PRO_PLUGIN_VERSION, '3.14.0', '<' ) + ) { + $notices[] = [ + 'priority' => 1, + 'show_close_button' => false, + 'type' => 'alert', + 'scope' => 'global', + 'title' => __( 'Upgrade to Dokan Pro Latest Version', 'dokan-lite' ), + 'description' => __( 'Your Dokan Lite version is updated to the latest version but you are still using the Dokan pro old version. Upgrade to Dokan Pro Latest version to enable the new features.', 'dokan-lite' ), + ]; + } + + return $notices; + } } From a8a0e53242ca150d878d128cab08b50485760412 Mon Sep 17 00:00:00 2001 From: Aunshon <32583103+Aunshon@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:14:13 +0600 Subject: [PATCH 2/4] Added dokan pro update message. --- includes/Admin/Notices/Manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Admin/Notices/Manager.php b/includes/Admin/Notices/Manager.php index 18671af0d2..ea101e0422 100644 --- a/includes/Admin/Notices/Manager.php +++ b/includes/Admin/Notices/Manager.php @@ -202,8 +202,8 @@ public function show_admin_commission_notice( $notices ) { 'show_close_button' => false, 'type' => 'alert', 'scope' => 'global', - 'title' => __( 'Upgrade to Dokan Pro Latest Version', 'dokan-lite' ), - 'description' => __( 'Your Dokan Lite version is updated to the latest version but you are still using the Dokan pro old version. Upgrade to Dokan Pro Latest version to enable the new features.', 'dokan-lite' ), + 'title' => __( 'Dokan Update Required', 'dokan-lite' ), + 'description' => __( 'To ensure all the feature compatibility and accessibility, Dokan Pro minimum v3.14.0 is required.', 'dokan-lite' ), ]; } From 116c21be5157cee88719a3d35ec1f85410d262e9 Mon Sep 17 00:00:00 2001 From: Aunshon <32583103+Aunshon@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:16:31 +0600 Subject: [PATCH 3/4] Added dokan pro update message. --- includes/Admin/Notices/Manager.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/includes/Admin/Notices/Manager.php b/includes/Admin/Notices/Manager.php index ea101e0422..bec78aed80 100644 --- a/includes/Admin/Notices/Manager.php +++ b/includes/Admin/Notices/Manager.php @@ -50,7 +50,7 @@ private function init_hooks() { add_filter( 'dokan_admin_notices', [ $this, 'show_permalink_setting_notice' ] ); add_filter( 'dokan_admin_notices', [ $this, 'show_admin_logo_update_notice' ] ); add_action( 'wp_ajax_dismiss_dokan_admin_logo_update_notice', [ $this, 'dismiss_dokan_admin_logo_update_notice' ] ); - add_filter( 'dokan_admin_notices', [ $this, 'show_admin_commission_notice' ] ); + add_filter( 'dokan_admin_notices', [ $this, 'show_admin_plugin_update_notice' ] ); } /** @@ -191,7 +191,16 @@ private function dismiss_notice( string $option_name ) { wp_send_json_success(); } - public function show_admin_commission_notice( $notices ) { + /** + * Show admin notice if dokan lite is updated to v3.14.0 and dokan pro is not updated to minimum v3.14.0. + * + * @since DOKAN_SINCE + * + * @param $notices + * + * @return mixed + */ + public function show_admin_plugin_update_notice( $notices ) { if ( version_compare( DOKAN_PLUGIN_VERSION, '3.14.0', '>=' ) && defined( 'DOKAN_PRO_PLUGIN_VERSION' ) && From d2dfb0d50ae2c164f8b85d3ffe1632d5299a4bfc Mon Sep 17 00:00:00 2001 From: Aunshon <32583103+Aunshon@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:24:54 +0600 Subject: [PATCH 4/4] Added dokan pro update message. --- includes/Admin/Notices/Manager.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/Admin/Notices/Manager.php b/includes/Admin/Notices/Manager.php index bec78aed80..f763bf1d4b 100644 --- a/includes/Admin/Notices/Manager.php +++ b/includes/Admin/Notices/Manager.php @@ -213,6 +213,13 @@ public function show_admin_plugin_update_notice( $notices ) { 'scope' => 'global', 'title' => __( 'Dokan Update Required', 'dokan-lite' ), 'description' => __( 'To ensure all the feature compatibility and accessibility, Dokan Pro minimum v3.14.0 is required.', 'dokan-lite' ), + 'actions' => [ + [ + 'type' => 'primary', + 'text' => __( 'Update Now', 'dokan-lite' ), + 'action' => admin_url( 'plugins.php' ), + ], + ], ]; }