Since the multiple-location updates, if trying to add location information through another module (e.g. GeoRSS module, in association with Aggregator2 module), foreach errors are returned in the location_nodeapi() function because locations are added during the insert/update phase, not the validate phase, where location module is expecting them. Problems also arise when using aggregator2 module without the GeoRSS module, when location fields are enabled on the feed entry node type.

The attached patch (against 4.7, but same applies for 5.0) escapes out of the location_nodeapi() function if the node types are location-enabled but have no $node->locations at that point in time. I don't think it breaks anything else - locations can still be added through the node form etc.

Comments

geodaniel’s picture

pknag confirms that this fixes a similar issue in http://drupal.org/node/113429 as well

geodaniel’s picture

Ankur, can you see any potential issues with this one? Safe to apply?

geodaniel’s picture

I've not tested this fully with other modules, but after applying the patch at http://drupal.org/node/109611 I didn't need to use this one. I'll update this ticket once I've tested some more.

geodaniel’s picture

Title: Allow location information to be added by other modules without foreach errors » Foreach errors when adding location information using other modules
Status: Needs review » Needs work

I've done a bit more testing and this is still relevant. Using the latest versions of Feedparser and GeoRSS module, the foreach errors are thrown for nodes that don't have location information being assigned (this patch fixes that). Replacing Feedparser with Aggregator2 and the same problem happens but it also gives a foreach error on line 88 of location.inc. Not sure why theme_locations is being called when agg2 is adding nodes, but I'll take a look and update the patch once I've had a chance to look into that.

geodaniel’s picture

Status: Needs work » Needs review
StatusFileSize
new2.11 KB

This updated patch stops the foreach errors with both modules I've tried it with - feedparser and aggregator2.

geodaniel’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Needs review » Patch (to be ported)

Committed on 4.7. I've not tried this in 5.x yet, but I suspect it's still relevant there as well.

bdragon’s picture

Version: 5.x-1.x-dev » 6.x-3.x-dev
Status: Patch (to be ported) » Fixed

I'm pretty sure this is fixed now.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.