Download & Extend

iCal Feed Causes File Not found Error With Location Enabled

Project:Event
Version:5.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When using event and location modules together you may get a php fatal error that complains about a call to undefined function. The function is called in event.module around line 830 and references location_form2api. I could not find that function anywhere in the latest Location 3 module(other than in the API reference text). This is what I did to fix:

if (module_exists('location')) {
    if (isset($node->locations[0])) {

      /*added this line */
      $posted_locations[0] = $node->locations[0];
    
      /* no longer support in location ??? so i commented it out - may cause issues for some field formats?
      $posted_locations[0] = location_form2api($node->locations[0]);
      if (!isset($posted_locations[0]['city']) || strlen(trim($posted_locations[0]['city'])) == 0) {
        $postal_data = location_get_postalcode_data($posted_locations[0]);
        $posted_locations[0]['city'] = isset($postal_data['city']) ? $postal_data['city'] : '';
      }
      if (!isset($posted_locations[0]['province']) || strlen(trim($posted_locations[0]['province'])) == 0) {
        $postal_data = isset($postal_data) ? $postal_data : location_get_postalcode_data($posted_locations[0]);
        $posted_locations[0]['province'] = isset($postal_data['province']) ? $postal_data['province'] : '';
      }
      */

      if ($output = theme('locations', $posted_locations, variable_get('location_suppress_country', 0) ? array('country') : array())) {
          $event['location'] = $output;
      }
    }
  }

The feed now works in iCal but I noticed that it's full of html. Perhaps converting to plain would be wise? But that would be another issue.

Comments

#1

subscribing

#2

subscribing; I had the same issue - thanks for you useful posting!

nobody click here