Astra_Admin_Settings::minimum_addon_supported_version_notice()

This constant will be used to inform the user about incompatible version of Astra addon.


Description


Source

File: inc/core/class-astra-admin-settings.php

		public static function minimum_addon_supported_version_notice() {

			if ( ! defined( 'ASTRA_EXT_VER' ) ) {
				return;
			}

			// ASTRA_EXT_MIN_VER < ASTRA_EXT_VER && ASTRA_EXT_VER < 4.0.0.
			if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) >= 0 || version_compare( '4.0.0', ASTRA_EXT_VER ) < 0 ) {
				return;
			}

			$astra_addon_supported_version = self::get_astra_addon_min_supported_version( ASTRA_EXT_VER );
			$message                       = sprintf(
				/* translators: %1$s: Plugin Name, %2$s: Theme name, %3$s: Supported required version of the addon */
				'Your current version of %1$s plugin is incompatible with %2$s theme. Please update to at least version %3$s for optimal functionality.',
				astra_get_addon_name(),
				astra_get_theme_name(),
				$astra_addon_supported_version
			);

			$ext_min_supported_version = get_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', true );

			if ( ! $ext_min_supported_version ) {
				update_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', $astra_addon_supported_version );
			}

			if ( version_compare( $ext_min_supported_version, $astra_addon_supported_version, '!=' ) ) {
				delete_user_meta( get_current_user_id(), 'ast-addon-minimum-supported-version-notice' );
				update_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', $astra_addon_supported_version );
			}

			$notice_args = array(
				'id'                         => 'ast-addon-minimum-supported-version-notice',
				'type'                       => 'warning',
				'message'                    => $message,
				'show_if'                    => true,
				'repeat-notice-after'        => false,
				'priority'                   => 20,
				'display-with-other-notices' => false,
			);

			Astra_Notices::add_notice( $notice_args );
		}

Changelog

Changelog
Version Description
4.3.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.