Google Maps API Missing Keys – Not Needed/Wanted Anyway

Home Forums Calendar Products Events Calendar PRO Google Maps API Missing Keys – Not Needed/Wanted Anyway

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1334918
    inhouse
    Participant

    Hello, I have “Enable Google Maps” unchecked in the calendar settings; however, I have 2 errors on my calendar page which indicate that the scripts are being loaded without API keys. Is this a bug or is there a way I can actually remove the scripts from loading on this page?


    Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys util.js:222
    Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error js?ver=4.8.1:35

    #1335274
    Cliff
    Member

    Hi. Sorry you’re experiencing this.

    Could you please send a link to a single event you’re seeing this at?

    Please also send a screenshot of this event’s wp-admin event edit screen to see its settings.

    #1335391
    inhouse
    Participant

    This is the calendar list view, not the single event template. I’ll send a link privately as this is an unpublished site build.

    Here’s a screenshot showing one of the events. Even if I check “Show Google Maps Link”, it shouldn’t mean the plugin loads Google Maps scripts on the list page especially when “Enable Google Maps” is unchecked.
    https://www.dropbox.com/s/sybbf9mh7fk5uzo/Screenshot%202017-08-15%2008.45.54.png?dl=0

    #1335648
    Cliff
    Member

    Gotcha. I figured it out.

    It’s due to Line 120 of /wp-content/plugins/events-calendar-pro/src/Tribe/Geo_Loc.php (PRO version 4.4.15)

    So if you have “Enable Google Maps” option unchecked at wp-admin > Events > Settings > General tab > “Map Settings” section

    … and even if you have PRO’s Map View unchecked at wp-admin > Events > Settings > Display tab > “Enable event views” option
    (this doesn’t affect anything but I did try it)

    … then it does load these:

    <script type='text/javascript' src='https://maps.google.com/maps/api/js?ver=4.8.1'></script>
    <script type='text/javascript' src='http://tribe.dev/wp-content/plugins/events-calendar-pro/src/resources/js/tribe-events-ajax-maps.js?ver=4.4.15'></script>

    If you look at Line 116 of the file I mentioned at the beginning, it includes this comment:

    Enqueue the maps JS in all the views (Needed for the location filter in the Tribe Bar)

    So, with all this information, are you still wanting these scripts to NOT load (i.e. you somehow disabled the “Near” search box in the Tribe Bar — a feature enabled by PRO)?

    #1335649
    inhouse
    Participant

    I definitely have “Hide location search” checked. We’re not using it. Nothing should be using Google Maps.

    #1335780
    Cliff
    Member

    Thanks for confirming.

    I’ve logged this bug and would expect it to be a quick fix (but can’t guarantee any timing).

    I’ll mark this ticket as Pending Fix, which means this thread should receive a reply once the applicable fix has been released. It’s in the development team’s hands now. They need to assign it, code it, test it, and schedule it for release.

    I apologize for this issue and appreciate your understanding and patience.

    P.S. if you’re wanting this fixed right away and are comfortable editing code, here’s some copy/paste code to replace the existing scripts() method in /wp-content/plugins/events-calendar-pro/src/Tribe/Geo_Loc.php

    	/**
    	 * Enqueue Google Maps Geolocation JS in all archive views if needed: 1) if the "Near" search is present in Tribe Bar (if Hide Location Search is unchecked), 2) if we are rendering Map View
    	 */
    	public function scripts() {
    		if (
    			tribe_is_event_query()
    			&& ! is_single()
    			&& (
    				! tribe_get_option( 'hideLocationSearch', false )
    				|| tribe_is_map()
    			)
    		) {
    			Tribe__Events__Pro__Template_Factory::asset_package( 'ajax-maps' );
    		}
    	}
    #1340249
    Nico
    Member

    Hey,

    Just wanted to share with you that a new maintenance release is out, containing a fix for this issue ?

    Find out more about this release → https://theeventscalendar.com/maintenance-release-week-21-august-2017/

    Please update the plugins and let us know if the fix works for you,
    Cheers,
    Nico

    #1350154
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Google Maps API Missing Keys – Not Needed/Wanted Anyway’ is closed to new replies.