this error occurs when a user clicks "Preview" button when creating a node which does not have "Location" enabled.

this function is still called when $variables['locations'] is an empty string or null.

function template_preprocess_locations(&$variables) {
$locs = $variables['locations'];
$variables['locations'] = array();
$variables['rawlocs'] = $locs;
foreach ($locs as $location) {
$variables['locations'][] = theme('location', $location, $variables['hide']);
}
}

could anyone take a look? thanks

Comments

jriedel’s picture

I just saw the same thing. Yes it seems to happen when doing a preview of a node type that has no location information.

yesct’s picture

Status: Active » Closed (duplicate)

marking as a duplicate of #319091: warning: Invalid argument supplied for foreach()

I think there were a bunch of foreach errors, but they have been fixed with the recent commits. Try a newer version like the 3.1-rc1 or the dev versions.