• Hello a number of our users (https://stockwoodparkrfc.co.uk) reported having issues where the calendar feeds were not updating when changes were made to fixtures on certain devices/software. One example was BusyCal on the Mac and also some versions of android operating system. After some research we discovered that some software/devices not only look at the date last updated in the Ical but also look at the E-tag in the page header before they look at the date updated on each record in the Ical. This is to stop unnecessary scanning of each record to see if changed. So – E-tag is checked first (E-tag is MD5 hash of output) and if different from previous then check each record to see if updated.

    We made this change to get this working in the ical.php file in the feeds folder.

    —-start of code snippet from ical.php

    // End output
    $output .= “END:VCALENDAR”;

    // Print headers
    header(‘Content-type: text/calendar; charset=utf-8’);

    // ***Modification Start
    // The E-Tag is not being changed when the output file is generated – Some Webdav clients do not like this and
    // do not then ‘see’ that the file has changed – updates to the calendars are then not displayed to the user.

    $etag = md5($output);
    header(‘Etag:’ . ‘”‘.$etag.'”‘);

    // ***Modification End

    header(‘Content-Disposition: inline; filename=’ . $post->post_name . ‘.ics’);

    // Print content
    echo $output;

    ——–end of code snippet from ical.php

    Can we get this included as standard – assuming we haven’t broken anything else by doing this. ??

    • This topic was modified 7 years, 4 months ago by garygomm.
    • This topic was modified 7 years, 4 months ago by garygomm.
    • This topic was modified 7 years, 4 months ago by garygomm.
    • This topic was modified 7 years, 4 months ago by garygomm.
Viewing 15 replies - 1 through 15 (of 21 total)
  • Roch

    (@rochesterj)

    Hi!

    Thanks for reaching out!

    That’s a great idea. I’ll send this to our dev team in our next weekly meeting and hopefully this or a similar version of this code can get pushed to our main release.

    Thanks!

    I have the same issue , feeds not updating after a change on Mac OS X calendar, google calendar and iOS calendar.
    I have tried the above code and still no luck.
    Question though. How I would find this most useful is being able to quickly add a comment ‘venue changed’ etc which appears in a ‘description’ field in the ical feed.
    Would such a change be enough of a change to trigger an update? Or would it have to be a time/date change???
    Thanks in advance.

    Thread Starter garygomm

    (@garygomm)

    ok, so check the following – these are some things we have found;

    1) The feeds update every 2 minutes on the website if I remember correctly – BUT – you need to check that your calendars are also refreshing every X minutes. The update will only occur after the longer of the durations. By default the MAC and Google are sometimes set to only refresh 1 time per year. This is set when you subscribe and depending on the version of OS you may or may not get the option to set this when you initial subscribe but you can change it afterwards.

    2) For apple devices you cannot add any of these calendars to the iCloud and use iCloud to sync across your devices. If you have for example a iPhone and a Mac you must add them to the iphone as a local calendar and then also to the Mac as a local calendar. For some reason when these calendars are added to the iCloud and not local they do not ever update. It’s a bit of a pain as you have to add to each device. This appears to be an Apple issue as the feeds were updating – we could see on the website feed the change was appearing.(See (4) below on how to do this) it was something on the apple device in the iCloud that was preventing this.

    3) For google calendars we sometimes we had an intermittent issue but were not yet able to resolve – 99% of the time it works. We also had an issue with google where for some reason some people were not able to subscribe – you just get an error message – we were not yet able to resolve.

    4) Any change to the calendar – including a comment such as you describe should trigger the update. Each record in the feed has a ‘date updated’ time stamp which is update when a change is made. This date is completely separate to the date/time of the event. You can see this in the ‘curl’ output – see below.

    To see if the calendar feed is picking up the change you make to the fixture you can use the CURL command (Linux/Mac) and see if the new data is appearing in the feed – this means website is ok and feed is ok – it must then be the client that has some issue.

    curl -i https://stockwoodparkrfc.co.uk/calendar/fixtures-u17?

    the above looked at the feed from the website : stockwoodwoodparkrfc.co.uk

    and at the event list called : fixtures-u17

    Hope this might help!

    • This reply was modified 7 years, 4 months ago by garygomm.

    Excellent response thank you!!!!
    1 – OK I didn’t know about the web timing but had set my mac to refresh every 5 minutes.
    2 – finding this tricky…so..first time I made the WP page, it generated the cal URL, I subscribed to this on the mac OS Calendar and same mac into google cal. I also sent the link to a friend who said they were also able to subscribe all good. Except for the not-updating. So…unsubscribed, cleared everything out, checked the CURL you advised and although not sure what this means, the set cookie time before the Max-Age=1800 appears to update (might just be the curl request time though??) Here’s what terminal pushed back at me..

    HTTP/1.1 301 Moved Permanently
    Date: Fri, 20 Oct 2017 11:18:34 GMT
    Server: Apache
    X-Powered-By: PHP/5.6.29
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Set-Cookie: PHPSESSID=1b22e98178f97a30b98d37fb5059de00; path=/
    Set-Cookie: wfvt_1751289587=59e9db8da9c87; expires=Fri, 20-Oct-2017 11:48:37 GMT; Max-Age=1800; path=/; httponly
    Location: https://www.surreyrams.net/spcalendar/u16-rams-i/
    Vary: User-Agent,Accept-Encoding
    Content-Length: 0
    Content-Type: text/html; charset=UTF-8



    So, I then made a change to the calendar, and tried to subscribe again but…this time an error is pushed back…it won’t let me subscribe at all!!
    This could be your 3) but it is in Mac OS Calendar. ANd iOS too…just not recognising the URL.

    ‘Tis always the way, something is sooooo close to being a great solution
    If you have any more ideas, I would appreciate it but thanks anyway, I really do appreciate your response and the time you took….

    Thread Starter garygomm

    (@garygomm)

    Sorry that did not help.

    I tried to subscribe to your calendar as well and get an issue with an error saying the data is invalid. when I do a curl I am not getting back a ical type formatted file. I suspect this is to do with the link. The data that I see looks like it is coming from a link that is not an ical type formatted feed and it looks like it might be another page that it is pointed to?

    On the calendar itself – what is the permalink that is shown when you go in and edit it? and also, have you changed your permalink type in wordpress since you created the calendar? it may have something to do with that. the permalink type is under settings on the wordpress menus.

    update
    looks like the system didn’t like the : in your modification

    header(‘Etag:’ . ‘”‘.$etag.’”‘);

    “unexpected : ” error message.
    Sorry, this means nowt to me but thought it might help ??
    Cheers.

    Thread Starter garygomm

    (@garygomm)

    Hi, The code is correct and works on our site. This is likely a symptom ofthe way the ‘ (single quote’ and double quote ” are being translated.) some editors change/shift the quotes to a different quote that looks the same but the software translates differently – extended ASCII character set – and does not work. The solution is to overtype using your keyboard and not copy and paste the ” and ‘ once you have pasted the code. i.e. paste that code in then overtype. What editor are you using? I use TextWrangler or the standard textedit on the mac.

    For the moment though take the code out and see if the feed becomes valid. let me know once done and I can try and subscribe from my side. This would at least show it’s nothing to do with permalink changes etc if you then make a change – use Curl to see if the change is picked up in the feed – if it is at least you know the issue is on the client side and not website.

    Make sense, I use TextWrangler too, have just gone to BBEdit….
    Have removed the code and still get issues (even though yesterday I didn’t and the link was the same
    BUT I think you are on to something as I am getting very odd re-directs now…will investigate the permalinks…I have changed them from the default but not for a week or so…ho hum.

    Hi
    I removed the modification code but still get an error and still getting odd redirects…will have to refresh permalinks I think….

    Just to confirm, you were right about the quotations, I had just copied from browser and it had curly quotes…

    Thread Starter garygomm

    (@garygomm)

    immediately before you change your permalink settings remember to delete the .htaccess file in your root folder so wordpress can regen this. Sometimes due to server settings this file may not get regen’d or regen’d correctly.

    I would be tempted to delete the file and update the settings just to get it regen’d just in case there is something ‘out of whack’ with the file which may explain the strange results you are getting.

    Apologies if you knew this already

    OK, reset the permalinks (changed saved, changed back) and the cal feed is now accepted. So, I am back at square one.
    I will now try your code, watching for quotes and…let’s see!

    Thread Starter garygomm

    (@garygomm)

    ha ha – good to know it was that – it took me aaagggesssss to figure it out when I got caught out by that.

    Thread Starter garygomm

    (@garygomm)

    if all is working don’t bother to delete the .htaccess file.

    Thanks for the .htaccess caution, unfortunately I don’t have access to the root, I am working entirely in WP admin (just helping my son’s team manager). But it all looks ok, I can recreate this situation….

    OK – without modification code, curl reports correct feed. You can try to subscribe if you like to check I understand that bit = it shows a bunch of calendar events.
    When I do add the code, and overwrite the quotes, it does something to upset the permalinks. Curl gives an error message, strange re-directs which I think might be because the plug-in is now deactivated if it gets a fatal error.

    After removing the mod code, I then refresh the permalinks and all works again.

    It really looks like it is me not being able to put the quotes in correctly since it works at your end…I have tried overwriting using my keyboard and overwriting by copying and pasting the single and double quotes directly from the editor in the browser frame.
    Leaving it in the ‘working but not updating state for now’ – will try it on my testsite where I have root access and update files directly…

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Calendar feed issue – Ical not updating after change’ is closed to new replies.