Venue not importing

This topic contains 23 replies, has 6 voices, and was last updated by  David Demastus 1 year ago.

Viewing 9 posts - 16 through 24 (of 24 total)
  • Author
    Posts
  • #24077

    Hi Jamie,

    Did you import the iCal feed before adding that script? If the plug-in finds an existing venue that matches LOCATION it will use that instead rather than importing the venue from the feed, so I wonder if that’s it?

    Everything looks good, but I’ll check that example iCal feed for you.

    Stephen Harris
    #24082

    Thanks Stephen,

    I did import the feed before adding the script, but I did try deleting the venues then re-importing the feed. I also added different venues to the feed each time.

    Your plugin is by far the best iCal importer I’ve tried to date so I really am trying to get this part working. Unfortunately, my PHP skills are quite fresh.

    Thank you again for your help.

    Jamie McCormack
    #24145

    Jamie,

    My apologies, there were a few errors in the script that I posted. I have now updated that script.

    Stephen Harris
    #24158

    Oh man, I’m kicking myself now for not trying that version of the code before! Haha, I just thought maybe it was an old version and put my trust in the version on the post instead.
    I must remember to explore ALL options.
    Your code above works a treat so I thank you very, very much for your help.
    You have the best events plugin suite ever.

    Thank you.

    Jamie McCormack
    #24159

    Hi again Stephen,

    Sorry to continue the questions, but after successfully importing all the venues and having their details parse into the correct areas, I noticed that the Google map doesn’t set it’s lat/long coordinates and will only do so if I re-enter one of the venue values (ie: city) or actually enter the coordinates. I was hoping this would be done when the values get imported as the iCal feed won’t be providing lat/long values.
    I did find another post where this particular thing has happened: http://wp-event-organiser.com/forums/topic/google-calendar-issues-no-venue-details-wrong-end-date/ and wonder if you have documented any help around using the geocoder library: http://geocoder-php.org/, which you mention in the last post entry.
    Also, is there any way to show the address and city values along-side the venue name?

    Thanks again for your help thus far.

    Jamie McCormack
    #24179

    Hi Jamie,

    Do the venues have a GEO property? I tested using the iCal snippet you provided at it imports the coordinates too (it does that even without the script).

    If there’s no GEO property then there’s no means of reverse geo-coding except via Google maps (which their licensing requires be done in displaying a location on a map – i.e. I can’t do it as a background process) or another third-party service which that PHP library you link to does. But I don’t have any experience with that library, unfortunately.

    Regarding displaying venue addresses, where do you want this displayed? There are various template files you can use (templates/eo-event-loop-single.php handles the appearance of an event on the events page(s), templates/event-meta-event-single.php handles the appearance of the single event page ) .

    There is an API for retrieving the venue details: http://codex.wp-event-organiser.com/function-eo_get_venue_address.html

    Stephen Harris
    #24196

    Thanks Stephen. Once again you have saved my day!
    All is working now and I’ve learned a lot along the way.

    Your plugin is excellent, as is your support, and it is very much appreciated.

    Thank you again.

    Jamie McCormack
    #43259

    Looks like the google ical location details are currently formatted like this now:

    Location: Name, Address, City, State Postcode, Country

    There is no comma between the State and Postcode, so both get added to the State field. Not sure how to modify the script to parse that correctly.

    David Demastus
    #43260

    If anyone runs into the same issue, this rewrite of the script seems to do the trick.

    add_filter( ‘eventorganiser_ical_import_venue’, ‘my_ical_set_venue_details’, 10, 4 );

    function my_ical_set_venue_details( $venue, $event, $event_id, $ical ) {
    // Get the location string
    $location = $venue[‘name’];

    // Split the location string by the last comma
    $parts = preg_split('/,/', $location);
    
    // Check if we have at least 4 parts
    if (count($parts) >= 4) {
        $venue_details = array(
            'name'    => trim($parts[0]),
            'address' => trim($parts[1]),
            'city'    => trim($parts[2]),
        );
    
        // Check if $parts[3] contains two words separated by a space
        $statePostcode = trim($parts[3]);
        $statePostcodeParts = explode(' ', $statePostcode);
        if (count($statePostcodeParts) == 2) {
            $venue_details['state'] = $statePostcodeParts[0];
            $venue_details['postcode'] = $statePostcodeParts[1];
        } else {
            $venue_details['state'] = $statePostcode;
        }
    
        // Check if there's a fifth part for country
        if (count($parts) >= 5) {
            $venue_details['country'] = trim($parts[4]);
        }
    
        // Merge the extracted details with the original venue
        $venue = array_merge($venue, $venue_details);
    }
    
    return $venue;
    

    }

    David Demastus
Viewing 9 posts - 16 through 24 (of 24 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.