Version 0.5 of my WordPress plugin, Google Calendar Events, has been released!
0.5 contains a couple of new features, which between them encompass a large proportion of the feature requests I have received over the last few months. Here’s a brief overview of the new stuff:
Event Display Builder
The old display options were pretty inflexible, and made things like showing the start and end time on the same line impossible, without hacking about with the code. The event display builder makes things such as this much easier.
I won’t go into too much depth here, as I’ve written an extensive guide, with examples, on how to use the feature. Some of the things that are now possible, that were previously difficult / impossible, are listed below:
- Handling of all-day events – Previously, you couldn’t differentiate between all-day and normal events, so start and end times for all-day events would be displayed as ’12:00 am’, which could be confusing. Now, using the
[if-all-day]and[if-not-all-day]shortcodes in the event display builder, you could display something like ‘All day’ rather than the start / end times for all-day events, whilst still showing the start / end times for ‘normal’ events. - HTML and Markdown parsing – If you enter HTML into any of the Google Calendar fields (title, location, description) it is sent as plain text in the feed data. Now, using the
htmlattribute, the plugin can convert the plain text back to HTML and display it as such. Markdown can also be parsed (if you have PHP Markdown installed), using themarkdownattribute. Thanks go to James Hicks for the Markdown stuff. - Greater control over the markup – You can now use whatever markup you like to structure the event information. This also allows you to change the ordering of the event information, or display several things on the same line, or make the event title into a link, or anything you like! You can also generate feed-specific CSS classes using the
[feed-id]shortcode.
If you have ideas for any other useful shortcodes for the event display builder, or have noticed any bugs, please let me know in the comments below, or here.
Flexible Event Retrieval Date Range
Previously, the date ranges you could specify for retrieval of events from a feed were very limiting. You could retrieve from 00:00 ‘today’, or from the beginning of the month, but that’s it. With the new ‘Retrieve events from’ and ‘Retrieve events until’ settings you have much greater control over the date range.
The options you can choose from are as follows:
- Now
- 00:00 today
- Start of current week
- Start of current month
- End of current month
- The beginning of time (Retrieve from only)
- The end of time (Retrieve until only)
- Specific date / time
However, you can also specify an offset, in seconds, to the above options (except for the last three), allowing a lot of flexibility. Here’s a few examples:
- Date range required:All of time!
- Retrieve events from: The beginning of time
- Retrieve events until: The end of time
- Date range required:The past
- Retrieve events from: The beginning of time
- Retrieve events until: Now
- Date range required:The future
- Retrieve events from: Now
- Retrieve events until: The end of time
- Date range required:Today
- Retrieve events from: 00:00 today
- Retrieve events until: 00:00 today, with an offset of 86400
- Date range required:This week
- Retrieve events from: Start of current week
- Retrieve events until: Start of current week, with an offset of 604800
- Date range required:Last week
- Retrieve events from: Start of current week, with an offset of -604800
- Retrieve events until: Start of current week
- Date range required:The past 12 hours and the next 12 hours
- Retrieve events from: Now, with an offset of -43200
- Retrieve events until: Now, with an offset of 43200
- Date range required:April 2011
- Retrieve events from: Specific date / time (1301616000)
- Retrieve events until: Specific date / time (1304208000)
These are just a few ideas, there’s lots of other possibilities too.
Custom Error Message
These are the two main error messages that the plugin displays if something has gone wrong:
The following feeds were not parsed successfully: 1. Please check that the feed URLs are correct and that the feeds have public sharing enabled.
No valid Feed IDs have been entered for this widget. Please check that you have entered the IDs correctly and that the Feeds have not been deleted.
You probably don’t want your site visitors to see these messages, so you can now specify a custom error message to display to non-admin users. As a logged-in admin user, you will still see the above messages.
You can upgrade to this version of the plugin through your WordPress admin, or by downloading from the WordPress plugin directory.
Many thanks to those that downloaded and tested the beta of version 0.5!
As always, any feedback is greatly appreciated. Add a comment below, or on the plugin homepage, or send me an email via the contact form.
Hi, I believe I’ve found a bug in 0.5
If current month has no events and the user navigates to next month in widget calendar, he can no longer navigate back to current month.
Hi Ben,
That’s interesting. Thanks for letting me know, I’ll look into it.
Ross.
When entering a calendar XML url from from Google into a feeds URL field, “https://” is reduced to “http://” causing the plugin to incorrectly display calendar entries.
Is there a way to revert to the previous version of the plugin?
Hi Daniel,
What do you mean by ‘incorrectly display’? Could you give some more details? As far as I’m aware, the information contained within a feed starting with
httpis the same as one starting withhttps. Please correct me if I’m wrong, however.Ross.
Good morning Ross. Prior to upgrading the plugin to 0.5 last night/early this morning, the URL for my second calendar feed (id 2) was:
https://www.google.com/calendar/feeds/ama9cg8sdkd7l951tnqq82b1n4%40group.calendar.google.com/public/basic
This calendar feed was working perfectly in Calendar Events prior to upgrading to 0.5.
When attempting to create a new feed for a third Google calendar (id 3), I entered the URL for this new calendar which also started with the “https” protocal, but while testing this 3rd calendar on a client’s wordpress site, the page resulted in an 500 internal server error. In trying to debug the issue I switched the URLs for my 2nd and 3rd calendar feeds respectively in the Google Calendar Events’ settings. The error now occurred for calendar feed ID 2 as well. When I attempted to reset calendar feed ID 2 to its original the URL that it had originally contained, the URL field modified the protocol to “http” instead of “https” as it was previously. Now calendar ID 2 does not display any entries for this calendar and every attempt to possibly see if this issue has something to do with the protocol being modified from “https” to “http” has failed.
Since everything was working perfectly up until the upgrade, I can only assume at the moment that this may be the cause of problem affecting my client’s site.
Does this explanation help? Is there a way to test between versions by downgrading to the previous version of Google Calendar Events?
Hi again Daniel,
Thanks for replying with more information. This seems quite odd!
It would be interesting to know the cause of the 500 error; do you have access to the server error log to find out?
There’s no automatic way to ‘downgrade’ the plugin, but you could just deactivate the plugin, delete the
google-calendar-eventsdirectory fromwp-content/plugins/, and then upload version 0.4.1 in its place.However, it would probably be simpler to just adjust the section of code in 0.5 that converts the URL. You would do this by editing line 247 of
google-calendar-events/google-calendar-events.php, so that instead of this:it reads this:
If you then re-enter a
httpsURL into the feed settings, it will no longer get automatically converted tohttp.The reason I added this automatic conversion into the plugin was because, on some server configurations, the plugin failed to parse
httpsURLs, but did not have a problem withhttpURLs. I’ve never heard of the opposite being the case (httpsworking,httpnot), so I figured it wouldn’t cause problems for anyone and would prevent confusion for those wondering why their feed URLs didn’t work because they begain withhttps. Perhaps this wasn’t such a good idea! Let me know if you discover anything in the error log, or if the above code change makes a difference.Thanks,
Ross
If I wanted to upload version 0.4, where could I obtain it? Could you provide a URL?
I will see if I can provide you with the server error logs.
All of the previous versions of the plugin are available here.
Ross.
Here is the displayed error as it appears on the page:
“Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@xyz.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.”
Thanks for this. Unfortunately, it isn’t much help, as this is the sort of generic ‘something has gone wrong’ message that you get with a 500 error. The actual cause of the error could be one of a multitude of things, and there should be more specific and detailed information in the server error log.
Ross.
I’ll continue to look into this to see if I can provide the proper information for you to use to determine and debug the problem. I just followed your instructions for deactivating and deleting version .5 and re-installing version .41 and everything is working fine now. I will have to perform test on my own WordPress development account with your string replace code edits listed above to see if that in fact was the issue. Unfortunately, I needed to get the calendar back up ASAP for the the client.
I will keep you posted on this as I really do like the simplicity and flexibility that your plugin offers.
That would be great, thanks.
I’m glad you’re back up-and-running again for the time-being.
Ross.
Ross, I updated to the newest version and got no widget calendar, but the following:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 1218828 bytes) in /home/content/99/6576099/html/wp-includes/functions.php on line 1007
Yikes! What do I do now? Is it possible to revert to the old plugin?
Thanks, Jim
Hi Jim,
Hmm, I’ve had a couple of reports of this now. The memory usage of the plugin seems to have gone up more than I thought in 0.5. Sigh! Back to the drawing board.
You could attempt to increase your memory limit by adding the following to your
wp-config.phpfile:If this doesn’t work you can revert to 0.4.1 by deactivating 0.5, then deleting the
google-calendar-eventsdirectory fromwp-content/plugins/. Download version 0.4.1 (from here), un-zip it, and then upload it towp-content/plugins/. You can then reactivate it from within WordPress as normal.Apologies for the trouble. I’ll work on reducing the memory usage, and get a updated version of 0.5 out as soon as I can.
Ross.
I get this error when I try to active on my wordpress site
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /homepages/33/d247427820/htdocs/durhambiker/wp-content/plugins/google-calendar-events/inc/gce-parser.php on line 150
Hi Ron,
I just replied to your email, but I’ll add my response here too for reference:
This error only occurs on servers running PHP 4. Most servers these days run PHP 5, and WordPress itself will no longer support PHP 4 as of version 3.2, so it would probably be a good idea to upgrade your server to PHP 5. If you get in touch with your web hosting provider, they should do this for you.
Ross.
It seems that after updating the plugin, our widget somehow broke – would you see any reason why this would happen? http://www.overmined.com
it has completely stumped me!
To remove the problem and not ruin the look of the website, you can see what happened here:
http://www.overmined.com/C13/calender.jpg
I’ve since tried re-downgrading, but it won’t go away.
Hi Tyler,
Are you using a custom stylesheet for the plugin? If so, it looks as though it has been overwritten / deleted during the update process.
You’ll need to recreate the custom stylesheet, I’m afraid. To prevent this happening in the future, you should place your stylesheet outside of the google-calendar-events directory (I realise this isn’t made clear in the instructions in the plugin, they’ll be amended in the next version).
Ross.
Okay, so we ended up fixing how it looks… However, is there a place in the plugin that time shifts the timezone by several hours? All our events are are 10 hours off from when they should be (as noted in the google calendar)
Hi Tyler,
What do you have your WordPress timezone set to (in Settings > General)? Is it the same as the timezone of your calendar (Calendar Settings, in Google Calendar)?
Ross.
Hi Ross,
I still can’t get a widget to work following upgrading to version 0.5. I deactivated it, deleted it, and uploaded version 4.1 as you instructed. NO small widget calendar appears on pages though. Curiously all the settings of the old install remain. Am I not deleting the old plugin thoroughly enough?
Hi Jim,
The settings remaining after deleting the plugin is normal (although not very good practice on my part, the next version will clean up after itself). Are you seeing any error messages where the widget should be, or just nothing?
If you are still getting errors relating to memory limits, I would recommend that you try installing the development version of the plugin. Over the last few days, I have rewritten much of the core of the plugin in an effort to improve performance. The dev version (which will be released as 0.6 shortly) uses significantly less memory than any previous version, caches data much more effectively, and is generally better behaved.
Let me know if you’re still running into problems though.
Ross.
I see nothing, no error messages or anything else.
Very strange.
Are you sure the widget is active (i.e not in the ‘Inactive Widgets’ area)?
If it is active, perhaps try deleting it, and then adding a new one.
Ross.
I’ve tried deleting and reinstalling several times. With zipped and unzipped versions. I’ve checked the server to make sure nothing remained after deleting, too. No luck.
Hi Jim,
Sorry, I didn’t mean delete / reinstall the plugin, I meant just delete the active Google Calendar Events widget (in Appearance > Widgets in your WordPress admin) and then drag a new one across from ‘Available Widgets’.
My apologies for the confusion.
Ross.
That didn’t work either.
Hi Jim,
This is very puzzling. So there’s definitely an active Google Calendar Events widget, but nothing is showing up at all?
I’ve noticed that none of the plugin’s stylehseets or scripts are being loaded onto your pages, which is also odd. However, you do appear to have a different plugin called Google Calendar Widget installed. This is a shot in the dark, but I don’t suppose you might have installed that plugin rather than mine (Google Calendar Events) by mistake? They do have very similar names!
Ross.
I was surprised to find Google Calendar Widget activated, so I deactivated it. My WP control panel shows GCE installed, stylesheet linked from “wordpress/wp-content/uploads/css/gce-style.css” and GCE settings normal. The same way they worked for months prior to trying 0.5. Reverting to 0.4.1 isn’t happening, though. Some cache problem? I’m stumped.
Hmm, me too.
It’s almost like the plugin is activated in the ‘back-end’ of your site (you can access the settings, widgets etc), but not on the ‘front-end’ (as nothing is showing up on the site itself), but I’m not sure if that’s even possible!
If something had gone funny with the widget, or even if you didn’t have an active GCE widget, the plugin scripts and CSS files should still be loaded in the
<head>section of the site’s HTML. But on your site, they’re not there.Do you have any caching plugins installed? It seems unlikely that one would cause this kind of issue, but it’s perhaps a possibility.
Ross.
No caching plugins installed. Here’s what I’m thinking now. Somehow I got two installations of WP on my server. I was reluctant to mess with it, since things were generally okay, and I was afraid of having to mess with .htcaccess, etc.—or worse yet, rebuild the site! So there may be a hitch with that. But the directory where GCE formerely lived and thrived is exactly where I put it again this time, without luck. It may be time for that long-avoided “housecleaning.”
Oh, I see. Yes, I guess that could be the cause of the problem. Although, as you say, it does seem strange that the plugin worked ok with this setup previously, but no longer does. I don’t think anything that I altered between versions would have an effect on this, but clearly something has changed.
I think you’re right, perhaps it is time to remove the extra installation. I would recommend you take a backup of all the site files and the database beforehand though, just in case!
Ross.
HI Ross,
I have trouble with the new version displaying only “Today’s Specials.”
I’ve got 4 Google Calendar feeds. Each is set like this: “From 00:00 today” (0 offset) to “00:00 today” (8640 offset). Trouble is, it displays events half way into tomorrow.
Luckily I tried this on my development server, and it’s not on my live blog. Any ideas?
Hi Jim,
What do you have your WordPress timezone (Settings > General) and feed timezones (in the plugin settings for each feed) set to?
Ross.
everything is set the New York
Jim,
I think I might have messed up and introduced another timezone related bug, whilst trying to fix the previous timezone related bug. Argh!
I’m hoping I have fixed it in the development version of the plugin. It would be very helpful if you could try it out on your dev server and let me know whether it does / doesn’t work. You can download the dev version here.
Thanks,
Ross.
Tried the dev version. It seems better now. Here’s a question, though. In addition to daily events I have a concurrent week-long event. Now “Today’s Specials” begins yesterday, the beginning of that multi-day event. I guess I should get in the habit of entering that type as an event repeating daily for the duration of the event, rather than one event lasting until X?
Thanks for your help.
Hi Jim,
I think enabling the “Show multiple day events on each day?” option addresses this issue. Or have I perhaps misunderstood your question?
Ross.
Excellent plugin. Would it be possible to have an additional “Retrieve events from” option? I’m thinking of “publish-date”.
That way, I can schedule posts in advance and still have the plugin showing the events. They would even show different info, which would be useful too.
Please, correct me if the current plugin version works that way already – then I just haven’t figured out how.
Hi Allan,
When you say “publish-date”, are you talking about the publish date of a post in WordPress? So, if you placed a shortcode on a post, it would only retrieve events from the publish date of that post?
That sounds like an interesting idea, but I’m not sure how easy it would be to implement. If I get some time, I’ll take a closer look.
Many thanks for your feedback,
Ross.
Yes, excactly what I meant – for example publish date plus a week if I set the 604800 in the shortcode setting.
The plugin was working fine until I noticed it’s calling events from yesterday. I use it as a widget titled, “Today’s Specials!” Time zones on each calendar feed and the whole site are set to New York. Each feed is set to: Retrieve Events from 00:00 today until 00:00 today offset 86400. Any ideas how to fix this? I “refreshed” feeds, too.
Thanks,
Jim
Hi Jim,
If possible, could you try with the latest development version? It seems to be handling this properly in the latest code. If you’re still seeing the same problem, please let me know.
Ross.
Hello,
Here we are in August 2011 and I want to show a calender of only October 2011 events for a festival taking place in October. I want the WordPress page to only show October on load and not the current month. I am using the AJAX display. I am using the ‘Retrieve Events From’ specific date/time feature using the unix codes for Oct 1 and Oct 31.
What am I doing wrong?
Thanks,
Erik
Hi Erik,
Unfortunately, this isn’t possible at the moment. Calendar grids will always default to the current month, regardless of when the first events occur. I’m looking into making this more flexible for a future release.
Ross.
Nice plugin, any idea as per when you ‘d like/could have the calendar display per default to the month of of the first upcoming event?
One other nice feature would be to force it to a specific month.
Looking foward to hearing from you and thanks for the good work.
Cheers
Hello,
I don’t currently have a lot of time to work on developing the plugin, so there’s no ETA on that at present, I’m afraid.
Ross.