When a location object is geocoded, the latitude and longitude don't end up in $node->locations. The problem is the for loop through locations works on a copy of the location information, and so when the geocoded information is added, it's added to the copy. This patch fixes it for me.
diff -u orig/location/location.module location/location.module
--- orig/location/location.module 2008-06-17 16:02:30.000000000 +0000
+++ location/location.module 2008-07-16 15:50:55.000000000 +0000
@@ -1014,7 +1020,7 @@
case 'update':
if (!empty($node->locations)) {
db_query('DELETE FROM {location_instance} WHERE vid = %d', $node->vid);
- foreach ($node->locations as $location) {
+ foreach ($node->locations as &$location) {
$lid = location_save($location, TRUE);
if ($lid) {
db_query('INSERT INTO {location_instance} (nid, vid, lid) VALUES (%d, %d, %d)', $node->nid, $node->vid, $lid);
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | location.module.patch | 1.42 KB | bdragon |
Comments
Comment #1
scottgifford commentedUpdated title
Comment #2
scottgifford commentedOops, version was wrong.
Comment #3
scottgifford commentedThat patch is incomplete, but I don't seem to be able to update the description for this bug. Here's an updated patch.
Comment #4
scottgifford commentedAdd note that patch is included.
Comment #5
bdragon commentedIsn't that a PHP5ism?
What about this?
Comment #6
bdragon commentedOf course, I forgot the & in location_save, but you get the picture.. ;)
Comment #7
scottgifford commentedHi bdragon,
It looks like it is a PHP5-only feature, I didn't realize that. I will try out your patch and let you know how it works for me.
Thanks!
Comment #8
scottgifford commentedYes, your patch seems to work fine!
Comment #9
bdragon commentedCommitted to DRUPAL-5--3 and HEAD.
Comment #10
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.