tec_automator_preload()

Determines if the plugin can be active based on the PUE and Plugin Register dependencies.

When the plugin cannot be active, it will show a message and soft-deactivate itself.

Soft-deactivation is done by keeping the plugin active but preventing it from loading.


Return

(bool) Whether the plugin dependency manifest is satisfied or not.


Top ↑

Source

File: src/functions/load.php

function tec_automator_preload() {
	if ( ! (
		function_exists( 'tribe_register_provider' )
		&& class_exists( 'Tribe__Abstract_Plugin_Register' )
	) ) {
		// Loaded in single site or not network-activated in a multisite installation.
		add_action( 'admin_notices', 'tec_automator_show_fail_message' );
		// Network-activated in a multisite installation.
		add_action( 'network_admin_notices', 'tec_automator_show_fail_message' );
		// Prevent loading of the plugin if common is loaded (better safe than sorry).
		remove_action( 'tribe_common_loaded', 'tec_automator_load' );

		return false;
	}

	return true;
}

Top ↑

Changelog

Changelog
Version Description
1.0.0 Introduced.