Telemetry::calculate_optin_status( bool $opted = null )

Calculate the optin status for the TEC plugins from various sources.


Parameters

$opted

(bool) (Optional) Whether to opt in or out. If null, will calculate based on existing status.

Default value: null


Top ↑

Return

(bool) $opted


Top ↑

Source

File: src/Common/Telemetry/Telemetry.php

	public function calculate_optin_status( $opted = null ) {
		if ( NULL !== $opted ) {
			return $opted;
		}

		// If they have opted in to one plugin, opt them in to all TEC ones.
		$status_obj = static::get_status_object();
		$stati      = [];
		$option     = $status_obj->get_option();

		foreach ( static::$base_parent_slugs as $slug ) {
			if ( $status_obj->plugin_exists( $slug ) ) {
				$stati[ $slug ] = $option['plugins'][ $slug ][ 'optin' ];
			}
		}

		$status = array_filter( $stati );
		return (bool) array_pop( $status );
	}

Top ↑

Changelog

Changelog
Version Description
6.1.0 Introduced.