Major Bug in GeoPress Map Function
There is a significant bug in the GeoPress map function. Take a look at this link, generated by the GeoPress map function:
http://www.whatsonchiangmai.com/map/
If you click on a map market, you will see multiple instances of the referring page, one for each time an edited page was saved. This is a bug that needs to be fixed.
http://www.whatsonchiangmai.com/map/
If you click on a map market, you will see multiple instances of the referring page, one for each time an edited page was saved. This is a bug that needs to be fixed.
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?whatonchiangmai,
Currently, GeoPress hasn't been updated to fix this bug. There is, however, a fix.
Please view the following thread, this should work for the time being, until GeoPress releases an official fix:
http://getsatisfaction.com/mapufactur...
I’m confident
-
Inappropriate?Hi Johnstonian,
Thanks for the reply. I checked the link and followed your fix in the code below:
function get_location_posts ($number = -1) {
global $table_prefix, $wpdb;
$geopress_table = $table_prefix . "geopress";
$sql = "SELECT * FROM $geopress_table, $wpdb->postmeta";
$sql .= " INNER JOIN $wpdb->posts ON $wpdb->posts.id = $wpdb->postmeta.post_id";
$sql .= " WHERE $wpdb->postmeta.meta_key = '_geopress_id'";
$sql .= " AND $wpdb->postmeta.meta_value = $geopress_table.geopress_id";
$sql .= " AND $wpdb->posts.post_status = 'publish'";
$sql .= " AND coord != ''";
if($number >= 0) {
$sql .= " LIMIT ".$number;
}
$result = $wpdb->get_results( $sql );
// Build a hash of Location => Posts @ location
$locations = array();
foreach ($result as $loc) {
if($locations[$loc->name] == null) {
$locations[$loc->name] = array();
}
array_push($locations[$loc->name], $loc);
}
return $locations;
}
function get_locations ($number = -1) {
global $table_prefix, $wpdb;
$geopress_table = $table_prefix . "geopress";
$sql = "SELECT * FROM $geopress_table";
$sql .= " INNER JOIN $wpdb->postmeta ON $wpdb->postmeta.meta_key = '_geopress_id'";
$sql .= " AND $wpdb->postmeta.meta_value = $geopress_table.geopress_id";
$sql .= " AND $wpdb->posts.post_status = 'publish'";
$sql .= " WHERE coord != '' GROUP BY 'name'";
if($number >= 0) {
$sql .= " LIMIT ".$number;
}
$result = $wpdb->get_results( $sql );
// echo $sql; // debug
return $result;
}
----------------
It does not appear to have worked on my end .....
http://www.whatsonchiangmai.com/map/
I wonder why?
I’m thankful
-
Inappropriate?interesting. I'm not sure why it would be different on your end. I'm not using the latest version of wordpress though.
One thing I did notice (but I don't think it will make a difference) is that I have the following line:
$sql .= " AND $wpdb->posts.post_status = 'publish'";
after this line in the get_location_posts():
$sql .= " AND $wpdb->postmeta.meta_value = $geopress_table.geopress_id"
So my SQL statement looks like this:
$sql = "SELECT * FROM $geopress_table, $wpdb->postmeta";
$sql .= " INNER JOIN $wpdb->posts ON $wpdb->posts.id = $wpdb->postmeta.post_id";
$sql .= " WHERE $wpdb->postmeta.meta_key = '_geopress_id'";
$sql .= " AND $wpdb->posts.post_status = 'publish'";
$sql .= " AND $wpdb->postmeta.meta_value = $geopress_table.geopress_id";
$sql .= " AND coord != ''";
if($number >= 0) {
$sql .= " LIMIT ".$number;
}
-----------------------------------------
Not sure why that would make a difference.
helpfulcanuck suggested using a plugin called 'disable revisions and autosave'. I haven't tried that though.
I’m frustrated
-
Inappropriate?Thanks for the help. I installed the plugin and will give it a try.
Also, I will try to rearrange the SQL "hot fix" and report back; but like you, it should not make a difference.
There may be a different table that needs modifying besides the posts table, because I used MyPHPAdmin to delete all the other entries for the posts in the database, and still get the same problem, even when I clean up the posts table!!!
I’m confused
-
Inappropriate?Update:
The WordPress plugin, disable revisions and autosave, worked on the new posts. For some very strange reason, adding to the SQL query as we discussed did not work.
Anyway, I found a new bug related to Locations, which I will post later.
I’m unconcerned
Loading Profile...


