Astra_Theme_Extension::minimum_theme_supported_version_notice()

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


Description


Source

File: classes/class-astra-theme-extension.php

		public function minimum_theme_supported_version_notice() {

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

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

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

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

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

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

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

			if ( class_exists( 'Astra_Notices' ) ) {
				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.