• Looks the plugin is still doing keyless access to Google Maps which has been deprecated by google platform.

    includes/gmw-location-functions.php

    // geocode the location
    $geocoded_data = gmw_geocoder( $geo_address, $force_refresh );

    array(2) {
    [“error”]=>
    string(16) “OVER_QUERY_LIMIT”
    [“data”]=>
    object(stdClass)#27103 (3) {
    [“error_message”]=>
    string(198) “Keyless access to Google Maps Platform is deprecated. Please use an API key with all your API calls to avoid service interruption. For further details please refer to https://g.co/dev/maps-no-account”
    [“results”]=>
    array(0) {
    }
    [“status”]=>
    string(16) “OVER_QUERY_LIMIT”
    }
    }

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Bob

    (@shallway)

    FYI I did provide my API Key GMW settings.

    Plugin Author Eyal Fitoussi

    (@ninjew)

    Hello,

    When Google Maps API key is provided in the settings page, it will pass it to the geocoder function. You can verify this by debugging the $this->params array in the geocode() method of GMW_Geocoder class.

    The issue could be somewhere else.

    Do you have other mapping plugins installed on your site?

    Do the plugin and its mapping features work otherwise, except for when you try using the function above?

    Thread Starter Bob

    (@shallway)

    Hello,

    I var_dumped $this->params and the api key is there. I also var_dumped $geocoded_data after if ( is_wp_error( $geocoded_data ) ) and the previous errors seems gone.

    I’m using rehub theme with dokan plugin to build vendor locator (with buddypress member extension enabled), here is the doc I followed https://rehubdocs.wpsoul.com/docs/rehub-theme/configuring-locators/

    The problem is when I update vendor location it doesn’t sync to buddypress member location, so the vendor locator can’t find that vendor.

    Here is a screencast https://www.screencast.com/t/VlLg7EbKld

    now the keyless access issue seems fixed, but the location sync still doesn’t work.

    Thread Starter Bob

    (@shallway)

    Eyal,

    With further debugging, I found sth. you might be interested.

    1.

    file: gmw-geocoding-providers.php
    class: GMW_Google_Maps_Geocoder
    method: get_endpoint_url

    code:

    
    
    apply_filters(
                            'gmw_google_maps_api_geocoder_url', array(
                                    'url_base' => $url . '?',
                                    'url_data' => http_build_query(
                                            apply_filters( 'gmw_google_maps_api_geocoder_args', $this->params ),
                                            '', '&' // !!
                                    ),
                            )
                    );
    

    The & parameter formats the request url to ….&key=…., which results the “Keyless access to Google Maps Platform is deprecated. ” error I reported.

    2.

    It looks google maps API now enforce restriction rules differently to client side api key and server side api key.

    Client side google maps API keys requires a referrer restriction.
    While server side google maps API keys requires non-referrer based restriction (like ip based).

    and one key can’t have both restrictions, so I had to create separate keys and hard-code the server side api key in GMW_Google_Maps_Geocoder

    
            public function get_endpoint_params( $options ) {
    
                    $location = ( 'reverse_geocode' == $this->type ) ? 'latlng' : 'address';
    
                    $params = array(
                            $location  => $this->location,
                            'region'   => $options['region'],
                            'language' => $options['language'],
                          'key'      => gmw_get_option( 'api_providers', 'google_maps_server_api_key', '' ), // !!
                    );
    
                    return $params;
            }
    

    GMW settings has only one key, which can either be used by the client or the server but not shared by both end. If my understanding is correct, you might want to add another configurable key into settings.

    Thread Starter Bob

    (@shallway)

    per above

    ”, ‘&’ // !!

    shoud be

    ”, ‘&’ // !!

    Plugin Author Eyal Fitoussi

    (@ninjew)

    Hi,

    Sorry for the delayed reply.

    Yes, you are correct regarding the API keys and the different restrictions. And that is most likely the issue with the server side geocoding.

    I should have figured that out, but thank you for doing so for me :).

    I am now working on a new version of GEO my WP. I will add a new input box in the settings page for the server side API key.

    Hopefully, I will have this ready soon as other users have been experiencing the same issue.

    Thanks again for your help.

    The fix above by itself did not work. I also had to apply the ‘url_data’ fix to remove the ‘&’ from the http_build_query() call. Once I did that fix, it all worked.

    Thanks

    Thread Starter Bob

    (@shallway)

    Hello,

    Is the new version ready?

    Plugin Author Eyal Fitoussi

    (@ninjew)

    @shallway,

    Yes, the new version ( GEO my WP v3.2 ) is currently in beta and you can download it from here.

    Please let me know if it works if you get to test it.

    • This reply was modified 6 years, 4 months ago by Eyal Fitoussi.
    Thread Starter Bob

    (@shallway)

    Thanks, I’ll wait for its release.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Keyless access to Google Maps Platform is deprecated’ is closed to new replies.