Tribe__Events__Pro__Geo_Loc::maybe_offer_generate_geopoints()

Check if there are venues without geo data and hook into admin_notices to show a message to the user.


Source

File: src/Tribe/Geo_Loc.php

	public function maybe_offer_generate_geopoints() {
		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
			return;
		}

		// This is only available when a custom Geolocation data API key is being used.
		if ( tribe_is_using_basic_gmaps_api() ) {
			return;
		}

		$done = get_option( '_tribe_geoloc_fixed' );

		if ( ! empty( $done ) ) {
			return;
		}

		$venues = $this->get_venues_without_geoloc_info();

		if ( $venues->found_posts === 0 ) {
			return;
		}

		add_action( 'admin_notices', array( $this, 'show_offer_to_fix_notice' ) );
	}