iCal single event import file creates new calendar

Home Forums Calendar Products Events Calendar PRO iCal single event import file creates new calendar

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #234156
    pagedesign
    Participant

    We have ECP installed on a WordPress site for a client and they are having issues when trying to import an iCal file for a single event into Outlook. The import file creates a new calendar rather than importing the event into their existing calendar.

    The .ics file includes this line which looks to be the culprit:
    “X-WR-CALDESC:Events for O-Ring”

    I’ve looked around the forums and there seems to be a workaround from a previous version of the plugin from 2012 – https://tri.be/support/forums/topic/ical-import-how-do-we-get-it-to-add-event-to-an-existing-calendar-in-outlook/ – involving modifying the plugin files, but I wasn’t able to access the MDNW link in the thread to even try patching it (and am hoping not to have to refix it every update).

    Is there any other known workaround or snippet to add to the functions file to remove that line from the .ics file for single events?

    Thanks!

    #234180
    pagedesign
    Participant

    Actually, its probably this line in the .ics file:
    “X-WR-CALNAME:O-Ring”

    #235363
    Barry
    Member

    Hi!

    There is a hook in place to help with just this sort of problem – tribe_ical_properties – and it’s basic usage is as follows:

    add_filter( 'tribe_ical_properties', 'modify_ical_output' );
    
    function modify_ical_output( $ics ) {
    	$find_this = "X-WR-CALDESC:Events for {something} \r\n";
    	$replace_with = ''; // Remove completely
    	return str_replace( $find_this, $replace_with, $ics );
    }

    Does that help here? It should certainly remove the need to modify core plugin code and reinstate your changes with every update.

    #235537
    Andy Fragen
    Moderator

    For the record the previous hack does not alter the core plugins files and is meant to be placed in your theme’s functions.php file, just like Barry’s code.

    #235538
    Andy Fragen
    Moderator

    I’m referring to gist.github.com/afragen/2831526

    #235539
    Andy Fragen
    Moderator
    #235853
    pagedesign
    Participant

    Thanks Barry, that worked perfectly.

    I’m sort of in that beginner to intermediate level of plugin development, so I apologize if the info about the ‘tribe_ical_properties’ hook was readily available/common knowledge. And thanks for the input Andy. I must have misunderstood the fix in the previous thread; I thought it needed to be combined with a modification of a core file to work properly.

    Thanks again guys!

    #237939
    Barry
    Member

    Glad it’s all sorted 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘iCal single event import file creates new calendar’ is closed to new replies.