August 23, 2016 at 3:28 am #16946
On my website I am displaying a custom map with lots of POIs via php, as described at http://mappresspro.com/mappress-documentation#toc-displaying-maps-using-php – it worked great, until the new version of Mappress Pro asked for an API Key.
I followed the instructions on http://mappresspro.com/mappress-faq to get an API Key and enable the APIs, but Mappress Pro 2.44 won´t store the key longer than one map request. I paste the key to Mappress Settings, save settings, then loading the map page in frontend – works, without any console messages. Reloading the map page – error “Google Maps API key is required” in frontend. Reloading settings page in backend: API key is gone, error “Google Maps API key is required” in backend, too.
Are there new parameters or functions to call when displaying maps via php? Or is it a bug?
Please help…I´m stuck :-/August 23, 2016 at 3:30 am #16947ChrisKeymaster
If that doesn’t help, please send a URL so I can see the problem.September 7, 2016 at 5:02 am #16948
That was my first thought, too. But clearing the cache did not solve the issue – the first map call works great, on second call the API key is cleared and the error message pops up.
http://pano.egm.at/panoramen/karte/September 7, 2016 at 5:02 am #16985
I found out what caused the problem: in my script I used the class Mappress_Options for temporary overwriting the settings from the options page – but Mappress_Options->save() also deletes the API key, if not set in the options array! Commented out these two lines – and the API key stays in the database:
$myOptions = new Mappress_Options(array(“initialOpenInfo” => false, “tooltips” => false, “autoCenter” => true));
For my project – solved. Nonetheless an unexpected behaviour.September 7, 2016 at 5:19 am #16986ChrisKeymaster
I’m glad you solved that, from the description I never would’ve guessed you were reading & saving the options in custom code.
Normally I would suggest making settings changes in the map object’s constructor or display() method, as shown in the documentation examples. But if you need to use the internal ‘options’ object, try calling the get() method first, to get the existing settings before calling the save() method to save them.
- You must be logged in to reply to this topic.