Accessing the calender link info

Home Forums Calendar Products Community Events Accessing the calender link info

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1623694
    Sara Dregney
    Participant

    At the end of each event, there are buttons for the user to send the event info to both their google calendar and their icalendar. Is this link detail stored? Can I access it from the api? I am currently sending event information from my website to an app and need to include a link for the user to add the event to their mobile device. Any other suggestions?

    #1625068
    Andras
    Keymaster

    Hi Sara,

    Thanks for reaching out!

    The export links are not stored. They are generated ‘on the fly’ by the following functions:

    • tribe_get_gcal_link()
    • tribe_get_single_ical_link()

    This can be found in this file:

    wp-content/plugins/the-events-calendar/src/functions/template-tags/ical.php

    The rendering takes part in this file:

    wp-content/plugins/the-events-calendar/src/Tribe/iCal.php

    Let me know if I can be or further help.

    Cheers,
    Andras

    #1625726
    Sara Dregney
    Participant

    Thank you, András, for your response. I’ll review and try to work through it a bit.

    #1626169
    Andras
    Keymaster

    Sure thing Sara.

    Let me know if I can be of further assistance.

    Cheers,
    Andras

    #1626666
    Sara Dregney
    Participant

    I’m not understanding how to put the two things together to create the link to append to my api file. It seems like the class of “Tribe__Events__iCal” needs to be used to get the program to render in the wp-content/plugins/the-events-calendar/src/Tribe/iCal.php. I’m afraid I don’t know how.

    Here’s what I’m using right now:

    function appp_get_hook_data( $object, $field_name, $request ) {

    $data = [];
    $apppeventid = $object[‘id’];
    $apppvenuename = tribe_get_venue($apppeventid);
    $apppical = tribe_get_single_ical_link($apppeventid);

    $appdate = get_post_meta( $object[‘id’], ‘_EventStartDate’, 1 );
    $data[‘post_list’][‘below_title’] = ‘<span class=”event-detail-info”>’ . date(‘F j, Y \a\t g:ia’, strtotime($appdate)). ‘<br />’. $apppvenuename. ‘<br />’. ‘</span>’;
    $data[‘post_detail’][‘below_title’] = ‘<span class=”event-info”>’ . date(‘F j, Y \a\t g:ia’, strtotime($appdate)). ‘<br />’. $apppvenuename. ‘</span>’;
    // Add a featured image to the single post view in the app
    $data[‘post_detail’][‘above_title’] = ‘<div class=”post-featured-wrap”>’ . get_the_post_thumbnail( $object[‘id’], ‘large’, array( ‘class’ => ‘post-featured’ ) ) . ‘</div>’;
    $data[‘post_detail’][‘below_content’] = ‘<span class=”event-ical”>’ . $apppical. ‘</span>’;

    return $data;
    }

    #1627382
    Andras
    Keymaster

    Hey Sara, I will need some time to look into that. I kindly ask for your patience.

    Thanks and have a great weekend!
    Andras

    #1632718
    Cliff
    Member

    Hi, Sara. I’m hoping to help here, but I’m unclear exactly what you’re wanting.

    Do you just want to generate the iCal and gCal export URLs?

    Or are you wanting to get those via our REST API?

    Or are you wanting to customize the content within the .ics file?

    #1633715
    Sara Dregney
    Participant

    Thanks, Chris. I currently have an app that displays event calendar information. I pull all the data through the api. I want users to be able to put the event from the app to their mobile phone calendar. Since the programming doesn’t link automatically to the ical/gcal calendars, the advice I received from the Apppresser support team was to replicate how The Events Calendar creates the code/link format for the calendars and insert it into my api template hooks.

    Therefore, as I understand it, I need to generate the url as the plugin does and then have it accessible in the REST API. Hopefully, I am explaining this correctly and I’ve answered your question. Please let me know what additional questions you may have. Any help is appreciated!

    #1634988
    Cliff
    Member

    Gotcha. Yes, visiting the .ics link on a mobile device should prompt them to add it to their calendar.

    Please use tribe_get_ical_link() and tribe_get_gcal_link() functions. There’s also another one to get a specific single event’s iCal (.ics) link. You can see these in action at https://github.com/moderntribe/the-events-calendar/blob/4.6.23/src/functions/template-tags/ical.php

    Out of curiosity (and of course to help if we can), please let me know how it goes.

    #1637667
    Sara Dregney
    Participant

    Thank you, Chris!

    You can see my code to append to the api file above. When I used the function tribe_get_single_ical_link(), it returns the event url appended with /?ical=1. Is this all that’s needed? When I hover on over the button on the website, the event url is appended with /?ical=1&tribe_display=.

    I have not been able to test this to see if it works because I’m not sure the code needed to pass a button with a clickable link through the api file. I tried numerous ways of going about this but so far it’s not working. Do you have suggestions?

    #1638127
    Cliff
    Member

    Glad to help as much as I can…

    For single event URLs, yes, /?ical=1 is all that’s needed for the iCal/.ics file.

    On a mobile device, it should just open it in the calendar app, not actually save the file to the device, like a text file, of course… but if it did, that would be the mobile device’s issue of how they handle .ics files.

    Anyway, the &tribe_display= only comes in when you are exporting multiple events, such as List View or Day View. There are (filterable) defaults for how many events should be included when exporting from an event archive view.

    BTW, file attachments don’t come through via email replies if you sent me any.

    Please let me know if you have any follow-up questions on this topic.

    #1638441
    Sara Dregney
    Participant
    #1638618
    Cliff
    Member

    Sorry, Sara, but I can’t advise any further on this customization request. This is partly due to our Scope of Support / Terms, but also because I don’t know the context of what app/API you’re building for.

    I’d recommend looking at the other github link file I shared and also this one: https://github.com/moderntribe/the-events-calendar/blob/4.6.24/src/Tribe/iCal.php

    Hopefully you’ll be able to make it over the finish line without much more trouble!

    If you need some coding help, you may want to reference our Customizations Documentation, which includes a link to Hire A Freelancer.

    Please let me know if you have any follow-up questions on this topic.

    #1649978
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Accessing the calender link info’ is closed to new replies.