This is most likely the trickiest point in the Woffice setup. We will try to explain everything here to make sure it is as clear as possible.
Which APIs are used?
First, let see which API is needed and for what purposes: in Woffice we use two Google APIs for the maps. Any API call requires an authentication so you must get at least a key.
API Name | Google MAP Javascript API | Google MAP Geocoding API |
---|---|---|
Purpose | – It turns Javascript code into a Google Map Using the API. – Create all the maps (members map, option maps, directory maps, events map…). – Mainly all the maps rendered in the frontend and client side. | – It turns addresses into GPS coordinates using Google API. – Members map only – It is not used within the map |
Key option location | Appearance > Theme Settings > General Options > GOOGLE MAP API KEY | Unyson > Woffice Members Map > Settings |
Requirement | Any other plugin using the same API can be a conflict cause. They all have an option to deactivate the the API call from their settings. Use the Theme one. | No conflict here is possible. |
When are API calls made? | Whenever a map is created on the user’s browser. | Whenever you hit the “refresh all coordinates” button on extension’s settings page. When any member saves his profile, a call will be made if the Location field is present. |
How to get a key for each API?
- Reach the API Google Dashboard: https://console.developers.google.com/apis/
- Create a new Project (the name does not matter):
3. Find the 2 APIs that must be enabled from the APIs library:
4. Enable each API:
5. Create an API Key within the Credentials section:
6. You’ll now find your key still within the credentials section:
Notes
- The same key can now be used for the 2 APIs.
- You can create several keys.
- You can restrain access to your key but for any issue, that might be harder to troubleshoot.
Troubleshooting issues
There are several issues that may occur due to your plugins, setup, settings. Yet, it works most of the time in one shot! 🙂 If you still have some issues please have a look below.
Google MAP Javascript API:
- Open you browser’s console (What is my console?), you should see an error somewhere regarding the Google Map. Just copy/past it in Google, you’ll find more details about it on their documentation: https://developers.google.com/maps/documentation/javascript/error-messages
Google MAP Geocoding API:
- Open a new tab in your favorite browser and reach: https://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false&key=KEY. Do not forget to replace KEY at the end with your Geocoding API key. You can find details on them on the official documentation.
If you still have any issue with the map not displaying, then please check whether you are using the Pro Event Calendar plugin or not. If so, go to your WP Admin panel > Event Calendar > Settings
Check “Exclude Google Maps JS file?” option and save changes .
Member Map not showing pins:
Please make sure you have filled in Google Map JavaScript API and Google Map Geocoding API.
After that, edit 2 or 3 user’s profile and make sure to fill the location from the location field for testing purpose. Country name should be enough for testing.
You can also set a budget in the Google Cloud console to limit the amount spent on these APIs: https://cloud.google.com/billing/docs/how-to/notify?hl=Fr#cap_disable_billing_to_stop_usage