tribe_events_views_v2_smart_activation()

Checks smart activation of the view v2, is not a function for verification of v2 is active or not.

Current only being triggered on plugin activation hook.


Return

(bool) Wether we just activated the v2 on the database.


Top ↑

Source

File: src/functions/views/provider.php

function tribe_events_views_v2_smart_activation() {
	/**
	 * Allows filtering of the Events Views V2 smart activation..
	 *
	 * @since  4.9.13
	 *
	 * @param boolean $enabled Determining if V2 Views is enabled\
	 */
	$should_smart_activate = apply_filters( 'tribe_events_views_v2_should_smart_activate', true );

	if ( ! $should_smart_activate ) {
		return false;
	}

	if ( tribe_events_views_v2_is_enabled() ) {
		return false;
	}

	if ( ! tribe_events_is_new_install() ) {
		return false;
	}

	$current_status = tribe_get_option( Manager::$option_enabled, null );

	// Only update when value is either null or empty string.
	if ( null !== $current_status && '' !== $current_status ) {
		return false;
	}

	$status = tribe_update_option( Manager::$option_enabled, true );

	if ( $status ) {
		// Update the default posts_per_page to 12
		tribe_update_option( 'postsPerPage', 12 );

		// Update default events per day on month view amount to 3
		tribe_update_option( 'monthEventAmount', 3 );
	}

	return $status;
}

Top ↑

Changelog

Changelog
Version Description
4.9.13 Introduced.