Tribe__Events__Aggregator__Service::has_meetup_authorized( bool $request_security_key = false )

Fetch Meetup Extended Token from the Service.


Parameters #

$request_security_key

(bool) (Optional) Whether to explicitly request the Meetup security key in the response or not.

Default value: false


Top ↑

Return #

(stdClass|WP_Error) Either the Event Aggregator Service response or a WP_Error on failure.


Top ↑

Source #

File: src/Tribe/Aggregator/Service.php

	public function has_meetup_authorized( $request_security_key = false ) {

		$args = $this->get_meetup_args();

		if ( $request_security_key ) {
			$args['secret_key'] = 'request';
		}

		$cached_response = get_transient( self::$auth_transient_meetup );

		if ( false !== $cached_response ) {
			return $cached_response;
		}

		$response = $this->get( 'meetup/validate', $args );

		// If we have an WP_Error we return only CSV.
		if ( $response instanceof WP_Error ) {
			$response = tribe_error( 'core:aggregator:invalid-meetup-token', array(), [ 'response' => $response ] );
		} elseif (
			false === $cached_response
			&& isset( $response->status )
			&& 'error' !== $response->status
		) {
			// Check this each 15 minutes.
			set_transient( self::$auth_transient_meetup, $response, 900 );
		}

		return $response;
	}

Top ↑

Changelog #

Changelog
Version Description
4.9.6 Introduced.