WordPress Events Manager Google Maps Fix
I’m running WordPress 3.0 with several different domains mapped to it. So www.siteone.com and www.anothersite.com, etc. are resolved to different blogs, which are all part of the main www.newportcreativegroup.com blog. I recently came across an error with the Events Manager plug-in(http://davidebenini.it/wordpress-plugins/events-manager/) where users were selecting locations when they posted a new event, but seeing the wrong location on the preview map.
What happens is that Events Manager pulls from the dbem_locations table of the main blog, not the blog you’re currently using. So if www.siteone.com is your main site and it has 20 different locations entered, one of which has an ID # of 10, when you are logged into the dashboard of one of the sub-blogs, the select menu for locations will pull up the location info. from the main blog. A location with an ID # 10 in the secondary blog will show up with the location and address of the location with ID #10 in the main blog.
The fix is to change two lines in the dbem_locations.php file. At approx. line 645 and line 671 it uses a jquery getJSON call that is bound to the onchange event for the location. If you select a new location from the drop down, the onchange fires and it sends a JSON request to get the location info. Simply change the getJSON request URL to this:
$j.getJSON(“<?php echo WP_PLUGIN_URL; ?>/events-manager/locations-search.php”,{id: $j(this).val()}, function(data){
By using the WP_PLUGIN_URL it includes the full URL to the plugin. WordPress is then able to parse out which blog you’re working with and select the correct table.
