Skip to content

Commit

Permalink
Add notice for version compatibility. (#2450)
Browse files Browse the repository at this point in the history
* Add notice for version compatibility.

* Added dokan pro update message.

* Added dokan pro update message.

* Added dokan pro update message.
  • Loading branch information
Aunshon authored Nov 28, 2024
1 parent 6466f42 commit bdf70ab
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions includes/Admin/Notices/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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_plugin_update_notice' ] );
}

/**
Expand Down Expand Up @@ -189,4 +190,39 @@ private function dismiss_notice( string $option_name ) {
update_option( $option_name, 'yes' );
wp_send_json_success();
}

/**
* 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' ) &&
version_compare( DOKAN_PRO_PLUGIN_VERSION, '3.14.0', '<' )
) {
$notices[] = [
'priority' => 1,
'show_close_button' => false,
'type' => 'alert',
'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' ),
],
],
];
}

return $notices;
}
}

0 comments on commit bdf70ab

Please sign in to comment.