REQUEST: ics format shortcode
-
I was thinking of developing this, but seems like a perfect fit for event rocket.
I want to have a url I can access from google calendar to fill that in from my events, to access like https://support.google.com/calendar/answer/37100?hl=en
I think it should by default have all of the events in the database, but as long as that can be configured in the shortcode arguments, that’s would work for me.
Standard The Events Calendar ics feed only returns the current month, I think, e.g., http://steeplechasers.org/events/?ical=1 , and they were uninterested in making any changes for this.
-
Interesting idea. How do you see it working? Would it be an extension of the current [event_embed] shortcode?
[event_embed limit="200" output="ical-button"]Something like the above?
I hadn’t thought about the button, but that would be a bonus.
Not sure exactly what limit is doing. Maybe [event_embed from=”beginning” to=”end” output=”ical-button” text=”button text” name=”some title for google display”] (not quite sure how the calendar name works in google calendar / ical, though)
Would the ical button would be formatted through css?
also [… output=”ical-url” …] would add flexibility.
I guess I had originally been thinking new short code, e.g., [event_ics …] or [event_ical …] — I bet that would that make the interface easier — do you agree? Then output=”button” or output=”url”, etc.
Else you could use event_embed and do something like format=”ical” output=”button”, allowing for other format types.
Thanks for considering this!
The reason I’m thinking of extending an existing shortcode is that people then have the option of using it’s existing capabilities to target a specific set of events (by date, category or whatever).
Not sure exactly what limit is doing
It just limits the number of events – otherwise on sites with large numbers of events there is a risk that when the feed is generated the site would “crash”.
also [… output=”ical-url” …] would add flexibility.
Good call, it may simply be better than a button and site admins can use it how they will.
Thanks. So I assume you are accepting this feature request?
Will you also be adding from=”beginning” and to=”end” or similar? or is that already available?
(when I said “Not sure exactly what limit is doing”, I meant, does it take 200 most recent, next 200, last 200 or first 200)
Thanks. So I assume you are accepting this feature request?
I certainly like that idea and have logged an issue so I don’t lose track of it π
Will you also be adding from=”beginning” and to=”end” or similar? or is that already available?
This sort of capability is already present – you can see a list of currently accepted parameters and learn more about how the existing system works here.
Thanks again!
Hi – I think you implemented this feature with a shortcode starting in 3.0. I finally had a chance to look at it. Unfortunately
[eventrocket_ical_link from="-3 month" to="+12 month"] Download events in ical format! [/eventrocket_ical_link]only returns 10 events, and there are more events within the window.
See http://sandbox.steeplechasers.org/event-ical-test/ for the source page for the above plugin, and you can click on Events in the menu bar to see what it should have returned.
I am running v 3.2 of event rocket, and v 3.12 of the events calendar pro
Actually, I was counting the number of VEVENT instances in the file, and there’s a BEGIN:VEVENT and an END:VEVENT, so it only returns 5 events.
This is the same a the ‘Number of events to show per page’ setting.
But if I change the shortcode arguments to include limit=2000, then I get 35 events. In that case, the filename is very large. See http://sandbox.steeplechasers.org/event-ical-test-2/
Should I infer that without the limit argument, the default number of events per page is used?
Is there anything which can be done about the filename?
Hi!
Should I infer that without the limit argument, the default number of events per page is used?
Yes: I probably should make this clearer in the docs, but I want users to be explicit about how many posts should potentially be returned, since on sites with a large number of events this has potential to cause problems if left unchecked.
Is there anything which can be done about the filename?
Possibly, but can you clarify what you feel needs to be done?
Well, when 5 events was returned the filename was ical-event-1031128910328821265.ics, but when 35 events was returned the filename was ical-event-1031128910328821265103310347871035103683410377781038691884676780698141371272778273482284289010667371045829847887784893.ics
Does the filename have encoded every event in the name? If that’s the case if a large number of events are returned the filename may exceed system limits.
I guess I don’t understand why the name gets longer.
That’s a good observation and something I failed to catch (or may not have been a problem when I first wrote that piece of code).
What Event Rocket actually tries to do is set the filename to something like this:
20150910114819-4b3403665fea6.icsNot designed for its aesthetic charm, but it comprises two sections – the first representing the date/time of the request and the second being near-unique – and is of a fixed length.
However, as with most things in Event Rocket, iCal generation fundamentally relies on The Events Calendar to do a lot of the legwork and, in this case, The Events Calendar is overwriting the suggested filename provided (like the one above) with its own.
Unfortunately, there’s not currently a way around this unless I have Event Rocket take over the entire iCal generation process (and I’m not going to do that).
It does seem like a legitimate concern, though, since an exported list view or month view could also conceivably contain a large number of events and suffer the same problem – so I’ll be sure to log a bug on the tracker for The Events Calendar itself since it does seem silly to increase the filename in this manner without any checks.
Yes I saw what you were trying to set in the code — that would be fine and manageable. Hopefully you can figure out a workaround for this.
Not sure how it affects my use case, though, as I’ll be putting the url into google calendar as an alternate calendar, and I doubt it will actually end up as a file on some file system, rather it is most likely to be taking the stream data directly.
I haven’t yet followed my full use case. I’ll post here if I run into more difficulties.
But it might affect others who used this differently.
Thanks
I tell a lie – it might be possible to fix this up with a little hack. Let’s say you consistently want the filename to be ‘events.ics’:
function ical_export_filename( $return ) { header( 'Content-Disposition: attachment; filename="events.ics"' ); return $return; } add_filter( 'tribe_ical_properties', 'ical_export_filename' )That should do the trick … but please note it is completely untested. (When I get a chance I’ll test and roll it into Event Rocket if it works.)
cool!
The topic ‘REQUEST: ics format shortcode’ is closed to new replies.