Home › Forums › Calendar Products › Community Events › Accessing the calender link info
- This topic has 12 replies, 3 voices, and was last updated 5 years, 5 months ago by Cliff.
-
AuthorPosts
-
September 17, 2018 at 12:38 pm #1623694Sara DregneyParticipant
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?
September 19, 2018 at 2:25 am #1625068AndrasKeymasterHi 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,
AndrasSeptember 19, 2018 at 12:44 pm #1625726Sara DregneyParticipantThank you, András, for your response. I’ll review and try to work through it a bit.
September 20, 2018 at 2:41 am #1626169AndrasKeymasterSure thing Sara.
Let me know if I can be of further assistance.
Cheers,
AndrasSeptember 20, 2018 at 10:05 am #1626666Sara DregneyParticipantI’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;
}September 21, 2018 at 7:59 am #1627382AndrasKeymasterHey Sara, I will need some time to look into that. I kindly ask for your patience.
Thanks and have a great weekend!
AndrasSeptember 27, 2018 at 3:58 pm #1632718CliffMemberHi, 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?
September 29, 2018 at 7:43 am #1633715Sara DregneyParticipantThanks, 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!
October 1, 2018 at 4:31 pm #1634988CliffMemberGotcha. 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.
October 4, 2018 at 11:06 am #1637667Sara DregneyParticipantThank 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?
October 5, 2018 at 5:43 am #1638127CliffMemberGlad 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.
October 5, 2018 at 9:49 am #1638441Sara DregneyParticipantThank you! How do you pass a button with a clickable link through the api file? I have tried numerous ways of going about this (<button>, ) but so far it’s not working. Do you have suggestions?
Here is my code 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;
}October 5, 2018 at 3:41 pm #1638618CliffMemberSorry, 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.
October 27, 2018 at 9:35 am #1649978Support DroidKeymasterHey 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 -
AuthorPosts
- The topic ‘Accessing the calender link info’ is closed to new replies.