Astra_Theme_Extension::min_theme_version__error()

Check compatible theme version.


Description


Source

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

		public function min_theme_version__error() {

			$astra_global_options = get_option( 'astra-settings' );

			if ( isset( $astra_global_options['theme-auto-version'] ) && ( version_compare( $astra_global_options['theme-auto-version'], ASTRA_THEME_MIN_VER ) < 0 ) && ( false !== get_theme_update_available( wp_get_theme( get_template() ) ) ) ) {

				$astra_theme_name = 'Astra';
				if ( function_exists( 'astra_get_theme_name' ) ) {
					$astra_theme_name = astra_get_theme_name();
				}

				$message = sprintf(
					/* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the Astra Theme */
					__( 'Please update %1$1s Theme to version %2$2s or higher. Ignore if already updated.', 'astra-addon' ),
					$astra_theme_name,
					ASTRA_THEME_MIN_VER
				);

				$min_version = get_user_meta( get_current_user_id(), 'theme-min-version-notice-min-ver', true );

				if ( ! $min_version ) {
					update_user_meta( get_current_user_id(), 'theme-min-version-notice-min-ver', ASTRA_THEME_MIN_VER );
				}

				if ( version_compare( $min_version, ASTRA_THEME_MIN_VER, '!=' ) ) {
					delete_user_meta( get_current_user_id(), 'theme-min-version-notice' );
					update_user_meta( get_current_user_id(), 'theme-min-version-notice-min-ver', ASTRA_THEME_MIN_VER );
				}

				Astra_Notices::add_notice(
					array(
						'id'                         => 'theme-min-version-notice',
						'type'                       => 'warning',
						'message'                    => $message,
						'show_if'                    => true,
						'repeat-notice-after'        => false,
						'priority'                   => 20,
						'display-with-other-notices' => true,
					)
				);
			}
		}

Changelog

Changelog
Version Description
1.2.0 Introduced.


User Contributed Notes

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