GCal Events - upcoming event list that pulls from google calendar

Se7enLC's picture

This module has been officially released. Please see the Drupal Project Page for most recent information! The released version is equivalent to version 1.0.9 as released in this thread.

Summary: A module which provides blocks which list the next few events on a google calendar.
Similar Projects: CCK/Views/Calendar, Event Calendar, Google Calendar Embed

CCK/Views/Calendar does not (yet) provide compliant ical feeds, is difficult to set up, difficult to add/modify events
Event Calendar does not (yet) work properly with Drupal 6.x
Google Calendar Embedding does not provide many configuration options. It doesn't allow you to specify a number of events to display, doesn't display events more than a month in advance, and doesn't adhere to the drupal themes.

I wanted to use google calendar to hold the calendars for my site, since google is very easy+fast to add and change events and provides a compliant ical feed. I wanted to avoid synchronized calendars, since they tend to be buggy and fall out of sync.

Not really a module idea anymore, since I already wrote up the module. It uses simplepie to download and parse a google XML feed and displays simple html to configurable blocks. I couldn't see an easy way to add a project listing, so I figured I would post the summary here and see if there is any interest in it.


  • Multiple (unlimited?) event blocks, individually configured.
  • Public + Private calendars supported.
  • Configurable timezone support
  • Template support for display
  • Configurable date/time format
  • Configurable number of events to display
  • Administration screens are NOT a mock-up - all options are functional (although the screenshot had to be pasted together because my monitor isn't tall enough)
gcal_events_screenshot.png79.19 KB
gcal_events_block_admin_full.jpg150.64 KB
gcal_events_admin.jpg39.46 KB


Definitely interested

spencerwyatt's picture

I've been looking for something just like this. Do you have a finished module? Need any help testing it out?

Alpha Release

Se7enLC's picture

I have a release of this module ready for testing if anyone is interested. Use at your own risk, but this module is just about full-featured and ready for prime-time. You can see it in action at http://band.mit.edu


* Multiple configurable blocks for different calendars
* Configurable time and date formats (can be set for all calendars, or overridden for individual blocks)
* Configurable admin names for blocks (so you can remember which is which in the block admin screen)
* Cache directory setting in admin panel
* Two-layer "themeable" event listings. Confusing, but powerful and should be able to handle just about any configuration.
* Integrated debug mode for useful debug output.

To install:

1). untar into modules directory
2). Download and install SimplePie (http://simplepie.org/)
3). Copy simplepie.inc into the modules/gcal_events directory
4). Create a cache directory that is writeable by the webserver (defaults to modules/gcal_events/cache)

To configure:

1). Enable the module in Drupal
2). In the module configuration, set the cache directory and number of blocks to display
3). In the block configuration screen, configure the blocks you want to use. Get the Calendar ID from google calendar.
4). Still in the block configuration screen, set the block to an active region and save.


This module gets its information from a google calendar XML feed. It is a simple feed, and is NOT able to handle recurring events. There is no known workaround for this bug that doesn't involve a whole lot of complicated parsing of calendar data that I wasn't interested in doing.

Please test this out and let me know if you find any bugs, if you can think of any features that are missing, or if you need any help with setup.

Is there an issues queue?

SmokingPixel's picture

First of all thanks for putting this module together. I'm fairly new to Drupal but can see that this'll be huge for easing the transition for clients used to using GCal.

Couple of issues I ran into:
When adding a calendarID that includes legible text (specifically: no+reservations_%7e_mv00190054__91006#tv@group.v.calendar.google.com), the feed URL builder doesn't output a URL that parses properly in the browser, resulting in an error:
Invalid UserId no reservations_~_mv00190054__91006

Got an out of memory error with simplepie.inc when I imported a large calendar, not sure if that's because of settings on my local server:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2686704 bytes) in W:\www\test\modules\gcal_events\simplepie.inc on line 8246

Otherwise it's working really well. Cheers!

calendar feed is not comming

sreepathi's picture

i integrated the google calendar it works fine. when i tried to integrate same calendar in linux box it showing the error

GCal Events[Block 1] A feed could not be found at http://www.google.com/calendar/feeds/1234kumar.siva@gmail.com/private-de...

but i added events in the following calendar. both calendar Id and private Id both are corrent .

where might be the issue. please let me know if need to doa ny configration in module level

CVS account?

bonobo's picture

Do you have a cvs account on drupal.org?

Do you plan on releasing the code there?

Tools for Teachers

Did you see this issue?

kyle_mathews's picture

There's already some progress in creating an iCal parser as part of FeedAPI, the logical place, imo, for a ical parser. I think it'd be a good idea to put your efforts there to avoid code fragmentation.


Kyle Mathews

Kyle Mathews

bill: Don't have a CVS

Se7enLC's picture

bill: Don't have a CVS account - how do I get one? I'll release there if the devs think I should. I probably won't be updating it all that much, since it's already done (and I don't plan on adding any more features to it)

Kyle: If my module was an ical parser, I'd agree :-P

It actually reads the gmail XML feeds, which aren't in ical format. Is FeedAPI still a good place for it to go? I'm not familiar with that module, but I'll take a look at it and see if it makes sense to put it in there.

Testing your Module

jdwfly's picture

Upon testing your module I have found a quirky bug. When your module looks for simplepie.inc it looks in the WEB_ROOT/modules/gcal_events/simplepie.inc and not WEB_ROOT/DRUPAL_ROOT/sites/all/modules/gcal_events/simplepie.inc. I believe that this is just a simple mistake in functions in your PHP code.

Here is your code...

//Where your simplepie.inc is (mine's in the root for some reason)
  if (!include_once($_SERVER['DOCUMENT_ROOT'].'/modules/gcal_events/simplepie.inc'))
  { drupal_set_message('GCal Events: simplepie.inc not found!','error'); return; }

It took me a few minutes to figure this out. I would like to see this changed to where it ought to be in the sites/all/modules directory. If I have time I might even change it myself.


Se7enLC's picture

Good find! For my setup, DRUPAL_ROOT must just be /, because I never noticed that bug.

What is the difference between /sites/all/modules and /modules in terms of installation or maintenence? In my installation, I don't have a /sites/all/modules directory at all, so it looks like modules install into /modules by default. Do you know if there's a variable I can access that will signify which directory should be used? I'm reluctant to change it in such a way as to break other installations if I can help it. There must be some way to get "MODULE_ROOT" or similar. If you find anything let me know - I'll try and look as well.

Found something that should

Se7enLC's picture

Found something that should fix it. Cache directory is now saved relative to document root. The default is found using drupal_get_path, so it should be able to handle whereever the module is installed to. You might need to do a "reset to defaults" on the configuration screen to make it fill in the cache directory properly. For me, it fills in modules/gcal_events/cache (note the lack of leading /)


What is the difference

Garrett Albright's picture

What is the difference between /sites/all/modules and /modules in terms of installation or maintenence?

The modules directory should only be used for core modules, whereas contributed (add-on) modules should go in the sites subdirectory. Since D6, themes work the same way.

The logic for this is quite simple; it makes upgrading to a newer version of Drupal a breeze. You just unpack the tarball of the new version, copy the contents of the sites directory from the old version into the sites directory of the new one, and bam, it's ready to go. If you have contrib modules in the modules dir, then you'll have to manually copy them from the modules directory of the old version if you don't want to lose them.

That being said, you should not assume that your module will be in sites/all/modules either. In a multi-site Drupal installation, it might be in sites/example.com/modules or something like that. The correct way to determine where your module is located is to use drupal_get_path().

Actually, stop coding for Drupal now until you buy and read this book from cover to cover. It's mandatory for Drupal development. (Or, at least, it should be).


Se7enLC's picture

Thanks for the explanation of the different module directories. Until this module, I've just been a "user" of Drupal, rather than a developer. I've been installing modules into /modules - but now I see I should instead be putting them in the sites dir. I suspect a fair number of other people do the same thing. Having never been told otherwise, the /modules directory seems like a great place to install modules :-P.

I'm already using drupal_get_path now after a suggestion I got on the irc chat. The version I linked to includes that change (although, originally the tar file was incorrect)

error in url

sjsoef's picture

I'd like to try this out- but I think there is an error in the 1.03alpha.tgz download address and I'm getting a file not found error.


sjsoef's picture

The url works now, but the zip file has 2 .infos and no .module.

Cache does not update

jdwfly's picture

The cache does not seem to get updated. We had an event on the 16th that is still showing up. When I disabled the cache it worked fine. When I re-enabled the cache it reverted back to the cached version and the event from the 16th showed up again. From glancing through the module code I couldn't find where you update the cached file but then again I didn't look very long. I guess I'll just turn off the caching until you can make the module auto update the cache file.

btw I tried running cron as well to see if that would update it but that did not work either.

For caching, I just used

Se7enLC's picture

For caching, I just used what simplepie had built in. I assume that it has a concept of a "cache age" and will delete and re-download once the cache is that old. If the cache lifetime is, say, an hour, that means that a change made to the calendar could take up to an hour to show up on the page.

Disabling cache forces simplepie to download the xml calendar for each request, so of course will get the latest version (at the expense of a slow-loading page).

If you don't change your calendar often but want to see changes immediately, you can try deleting the contents of the cache folder. If simplepie doesn't have a cached copy it will download a new one and the changes will display immediately. That's the best way I've found to make sure a new event shows up while still having a cache available.

Found solution

jdwfly's picture

There are two variables for caching in simplepie. One was set to one hour and the other was set to seven days. I changed the one that was set to seven days to one day. After changing this variable the cache got updated.

Can't Install

Silentconqueror's picture

I have been trying to install GCAL Events for a number of days now,unfortunately i'm having a problem. When I download the zip file, seems tobe only one file in the zipping. I upload this file to drupal and for some reason no module will be created. I'm using Drupal 6.4, so I assume it should work. Anyone know what the problem is?

You're probably seeing the

Se7enLC's picture

You're probably seeing the one folder in the archive. The folder is called "gcal_events" and it should contain gcal_events.info, gcal_events.module, and INSTALL.txt

If you put those three files in the sites/all/modules/gcal_events directory, you should see the module show up in your module list on the admin page.

Make sure this is the copy you are downloading:


If you're still having a problem, let me know. Make sure you have:


and not a gcal_events/gcal_events/gcal_events.module or something

still a problem

Silentconqueror's picture

I still have the problem. I extract and it creates a folder called "gcal_events_1.03alpha~". Inside that folder there is 1 file called "gcal_events_1.03alpha", it is an Alpha03 file. That is all that is found for me.
I'm on windows XP using Winrar, not sure if that makes a difference. maybe if u could add another link with a winzip compression, it might work for me.

Yeah, I didn't realize you

Se7enLC's picture

Yeah, I didn't realize you were doing this in windows. WinZip should actually be able to read the tar/gzip file that I originally posted. What I think is happening is that it is un-gzipping and creating a tar file, but you're not opening the tar file and extracting the contents. Usually you do both the gzip and tar steps at the same time, but if you've never worked with a tgz or .tar.gz file before, you wouldn't be familiar with that.

Rather than try to fix that problem, I just made a zip-formatted file.



Silentconqueror's picture

Thank you very much for the help. I have it installed and running right now. The only problem I have is that the times are not correct. Is there anyway to advance the hr by say +3?

I remember having an issue

Se7enLC's picture

I remember having an issue with that myself awhile back. Try this version, it's the one I'm currently using, and I don't think it has that issue.


Can't reach the module configuration

beanworks's picture

I followed the directions above, and placed the files in the home/myroot/public_html/mysite.com/sites/all/modules/gcal_events directory.

I enabled the module. When I go to site configuration and click on the link to GCal Events module settings I get this:
Fatal error: Call to undefined function message_access() in /home/myroot/public_html/mysite.com/sites/all/modules/gcal_events/gcal_events.module on line 40

Before I go digging in the code (and likely do more damage than good), is there something I'm missing here?


What version of drupal are

Se7enLC's picture

What version of drupal are you using? the gcal_events module is written for Drupal 6.x, and I don't expect that it will work at all on older versions.

Quickly looking up the message_access function, it looks like that is part of Drupal 4.6 and has long since been removed. I'll see if I can add a version check to the code to make sure that it doesn't try to run on older versions.

Wow, thanks for the quick reply!

beanworks's picture

I am using 6.5

It's running on a host using *nix.

I have other unrelated domains running on the same account, so I have been installing drupal separately on each domain, rather than doing a multi-site installation.

Could that be a problem?

Looks like I jumped the gun

Se7enLC's picture

Looks like I jumped the gun on my diagnosis, actually. The "message_access" function call is actually IN my module, and shouldn't be. It's being executed when a non-administrator is trying to access the admin pages. I'm going to take a look at that and see how to do that properly, I should have a new version to fix that soon.

For now, just assume that instead of an error, you were seeing "you do not have sufficient permissions to access this page" and see if that helps explain anything (maybe you have a weird admin account? Can you think of anything permissions-wise that are different than normal?)

Ah, yes, that would explain it

beanworks's picture

I set up a siteadmin role with access to all the admin functions so I wouldn't have to be logging in as the actual admin. I was doing some updating just now and got the "you do not have permissions" message, so I logged back in as admin. I will try it again.


Yep, worked

beanworks's picture


Public Calendars

beanworks's picture

Well, it didn't work at first, because I was trying to link to a private calendar, using the private calendar link. When I saw the error, however, I realized it has to pull from the public calendar. I changed the calendar settings and it is working beautifully.

Future feature request, however, (which I may work on if I have time) would be to pull from events using the private calendar settings.

Thanks for putting this module together!


I fixed the administration

Se7enLC's picture

I fixed the administration issue. I had used "administrator" when I should have used "administration". Any user that has been granted "access administration pages" access should now be able to administer gcal_events. You would also need block administration, of course, to edit the blocks.

Great idea for a feature! It was an easy thing to add, so I just went ahead and did it. The block admin page now has space for a Calendar ID and a Private ID. If you leave the private ID field blank, it will use the public calendar. Note that if you use a Private ID and turn on debugging, it will display the Private ID XML address with the other debug messages, so use caution if you don't want that ID to get out. Also, it is being stored in plain text in the database.

Here's the updated version, let me know if that works for you:


Hmmm. Seems to have broken something

beanworks's picture

Might be me. I'll have to straighten it out tomorrow and see what happened.


Not sure what's happening or why

beanworks's picture

When I changed out the version to 1.06, it started throwing errors about the GCal module requesting headers, and frequently on a refresh, would display nothing. This would also happen when saving changes to one of the admin pages. Going back to the base URL would bring back the site, with the appropriate message (e.g., "Configurations saved").

I tried going back to the previous version, but the problems continued, so I just did a complete reinstall of drupal 6.5, without GCal, then put the module in and did an update.php. The blank displays started happening again, so I took out that version (removed the gcal_events folder) and put in the 1.03alpha version (and copied the simplepie.inc and cache folder from the backup into the new gcal_events folder). Everything seems to be working fine now.

I think I'll do a dummy site that I can link to here, and try it all over again.


No idea what the deal is

Se7enLC's picture

No idea what the deal is with requesting headers, but any time a blank page shows up, it means that there's a php error. My guess was that it was related to the timezone feature (which requires php 5.1).

I just posted 1.0.7 to the same place (http://www.mit.edu/~je18337/drupal/gcal_events_1.07.zip). This update now checks the PHP version before calling timezone related functions. If the timezone functions are not supported, the timezone modifications are skipped, and "local time" is used. If php version incompatibility was the problem, this change should fix it. Timezones are usually unneeded if the server is set up with an appropriate system timezone, it was only added to handle the rare case of a server that only knows GMT (or is set up in a location different from the target audience).

Check version 1.08 that I

Se7enLC's picture

Check version 1.08 that I posted below. I think I have a fix for the White Screen of Death.

This thread is starting to get crowded. I definitely need a project page...

Somewhat Fixed

d3vo's picture

I compared files from old version to the new version and deleted line 570 which included this:
$outputText .= variable_get('gcal_events_footer_' . $which_block, '');
This seems to fix the blank page problem after login, logoffs, saves, and updates.

Thanks for fixing the timezone issue. This is a great module that we will be using for our new school website. Another idea for this module would be to make the event title a link to the google event details. There is a similar component for Joomla that has that feature. You can download it from here http://www.moraviacsd.com/downloads/gcal_events_1.07.zip

bizarre. That footer line

Se7enLC's picture

bizarre. That footer line looks like it should work fine. It looks up in the database for a variable called gcal_events_footer_0, gcal_events_footer_1, etc. If the variable doesn't exist, it should be returning "" and adding that to $outputText. Any idea what the PHP error is for that? I'll look into that a little further.

The idea for the module is a good one - I've gone one step further and let you do whatever you want with the title by using templating.

For example, if you make your title template look like this, it will contain a link to the URL: <b><a href="#URL#">#TITLE#</A></b><br>

You can do the same thing with the Location field to make it be a link to the location: <a href="http://whereis.mit.edu/map-jpg?mapterms=#LOCURL#&mapsearch=go">#LOC#</A><br>

You can replace that with a crafted google map search, for example.

The goal behind the templating was to make it very flexible. You can delete any of the items to have them not display at all (title, for example, if every title for a calendar is "game" or "rehearsal" for example, you can just list the date+location.)

OMFG you HAVE to be kidding me...

Se7enLC's picture

I found the fix for the "White Screen of Death"...

Apparently Drupal Modules need to have an opening php tag, but CANNOT have a closing tag!

I made that tiny change, and now I no longer see a blank screen all the time. Also, I believe this will clear up the modifying headers error.



d3vo's picture

I guess I overlooked the #URL# template. Thanks Work great!

Official Release

Se7enLC's picture

Thanks to everyone for the help in testing! This module has now been officially released!

GCal Events Project Page

Please upgrade to the version posted there and report any bugs or errors you run into.

Um, report bugs here?

beanworks's picture

Dang, I hate to keep breaking this, it is such a cool module. I took out the old, put in the new, tried to go the admin section to enable it and got this:

Fatal error: Cannot redeclare class SimplePie in /home/[userroot]/public_html/test/sites/all/modules/gcal_events/simplepie.inc on line 382

Then I discovered somehow SimplePie had disappeared, so I put that back in and copied the new simplepie.inc to the gcal_events folder. But the same error message come up instead of the admin page.

So I went to the original site that has the 1.03 alpha on it, and it is now giving the same error message when I try to go to the admin pages!

I delete the gcal_events folder and there's no more error message!

sorry. :-( I'm wondering if something happened to simplepie?

Thanks for all you've done!


beanworks's picture

I put the newest release into the original site again, and everything seems to be working fine, using the public google calendar.

I think my server host is buggy. :-)

Now to try it on test.clbean.com with the private calendar.


Working perfectly!

beanworks's picture


using 2 different private calendars (from the same Google account).

One note, maybe a bug, maybe a feature: the Private ID is cleared each time the block is configured. (e.g., I wanted to make the titles bold, so I went back into the block configuration. The private ID was gone from the block, so I had to put it in again, before saving the other changes).


Good find! There was a typo

Se7enLC's picture

Good find! There was a typo in the code. privatE is not the same as private. I fixed it in CVS, but it might be awhile until a HEAD snapshot is available.

I've seen that redefined

Se7enLC's picture

I've seen that redefined simplepie error before. If you have more than one module that uses simplepie, it will come up. At some point I should work on having it not include simplepie again if it has already been included.

Only happens on siteaddress/?q=admin

beanworks's picture

Which makes it hard to get to the admin menu :-)


yeah, come to think of it

beanworks's picture

I have it in the feedAPI module. I'll disable that since I'm not using it and see if the error goes away.


Yeah, I finally got fed up

Se7enLC's picture

Yeah, I finally got fed up with that problem and fixed it. It should be in the development snapshot on the project page now.


beanworks's picture

No more error!


ramindya's picture


I am trying to embed complete google calendar in my drupal 6 website. I am not sure how to do it ? I tried googling but I didnt get enough information regarding this.
P.S : I am able to show the events in the drupal website by importing the module called Gcal_events but this not I want.

I liked to embed complete Google calendar.

Kindly let me know if you have any information regarding this.

Thanks in advance,

I'm also in that boat,

brack11's picture

I'm also in that boat, migrating from Joomla and as my company requires to embed searchable calendar from google calendar I used GCalendar extension for Joomla and it was satisfaction however, moving to joomla for the sake of CCK and advanced theming I get into trouble with building in GCalendar in Drupal. So far the company site stays on Joomla and I need to produce calendar solution for leadership to actually proceed with migration. Please help me someone! I tried to use FeedAPI and Feeds successfully importing iCal to nodes with FeedAPI but there are 99% of recurring events in calendar so the calendar is actually stays empty. Didnt find solution for recurring events.

Getting error in Gcal events

karthick62's picture

I am trying to use gcal event module in my sie.
When i entered calendar ID with the following ID. I am getting an error
http://www.google.com/calendar/feeds/karthick000%40gmail.com/public/basic. I tried giving my emailid as karthick000@gmail.com in calendar ID.

I am getting an error
GCal Events[Block 1] A feed could not be found at http://www.google.com/calendar/feeds/karthick000@gmail.com/public/full?m...

I have enabled my google calendar as public. created cache module and used simplepie .inc. Could some one tell me how to use this gcal module.I could not get enough info from the documentation in the project page.

Thanks in advance

why need simplepie?

rbakker's picture

Thanks for this useful module; however why use simplepie?
I got many php notices caused by simplepie, for example
due to this construction: $var =& new object()
that should be $var = new object()
In your own code you noticed memory problems with simplepie.

So I rewrote part of gcal_events_get_events to avoid simplepie.

See the code here: http://paste2.org/p/1805489