I have created a private Google Calendar and used the calendar ID in the Agenda module settings, but none of the events show up. I have three other public calendars that events are all showing up just fine for. Is it not possible to publish upcoming events using Agenda with private calendars?? Thanks in advance.

CommentFileSizeAuthor
#9 agenda.module_.txt12.58 KBdtkav

Comments

aidanlis’s picture

Title: Must make calendar public?? » Allow viewing of private calendars
Category: support » feature
Priority: Normal » Minor

Nope, not possible at the moment, sorry.

ClearXS’s picture

Like to have calendars not connected to Googles intelligence affiliated Big Brother world corruption leaders affairs; some can be open for them, others only for certain roles or groups.

mickster917’s picture

I just created an intranet site for my organization and wanted to be able to use a Google Calendar for events associated with the employees. Don't want them to be searchable or viewed by the public.

aidanlis’s picture

Your organisation is welcome to sponsor the development of this feature ...

mangus580’s picture

This feature exists in another module - gcal_events - and works nicely. Maybe some of the code there might be useful for here?

dtkav’s picture

if you are just using one private calendar (total)
you can edit agenda.module to use your private address.

your private address can be found under calendar details. click the xml button under private address at the botom of the page and you will get a link that looks like this:

http://www.google.com/calendar/feeds/your email/your private address/basic

then in your agenda.module file you can edit

define('AGENDA_SOURCEPATTERN', 'http://www.google.com/calendar/feeds/%s/public/full?hl=en&singleevents=t...');

to read:

define('AGENDA_SOURCEPATTERN', 'http://www.google.com/calendar/feeds/%s/your private address/full?hl=en&singleevents=true&sortorder=ascending&orderby=starttime&start-min=%s&start-max=%s&max-results=%d&ctz=UTC');

mangus580’s picture

What about multiple private calendars?

aidanlis’s picture

Change:

define('AGENDA_SOURCEPATTERN', 'http://www.google.com/calendar/feeds/%s/public/full?hl=en&singleevents=true&sortorder=ascending&orderby=starttime&start-min=%s&start-max=%s&max-results=%d&ctz=UTC');

To:

define('AGENDA_SOURCEPATTERN', 'http://www.google.com/calendar/feeds/%s/full?hl=en&singleevents=true&sortorder=ascending&orderby=starttime&start-min=%s&start-max=%s&max-results=%d&ctz=UTC');

Then enter your addresses as:
aidan@php.net/public
yourprivatecalendar@calendar.google.com/yourprivatekey

dtkav’s picture

StatusFileSize
new12.58 KB

i hacked up this solution. it no longer supports just entering email addresses (although that could easily be added), but you can put in multiple private and public addresses in the long format (i.e. http://www.google.com/calendar/feeds/your email/your private address/basic).

i attached my agenda.module file (i had to rename the attachments... ugh). you also need to edit agenda.admin.php and delete this block of code starting on line 255 (just search for it)
which was in place to make sure you entered a valid email (which the long format _isn't_)

    foreach ($ids as $id) {
    if (!valid_email_address($id)) {
      form_set_error('agenda_calendars', t('Invalid calendar ID'));
    }

cheers,

DK

dtkav’s picture

Aiden's solution is a lot more elegant than mine :P
does that still pass the form email verification?

aidanlis’s picture

Good pickup, you'll need to remove the check for an incorrect email address still.

Dote’s picture

Issue tags: +urlencode

Hi there.

After doing the changes written by Aidan, still had errors because when I introduced the address as:
yourprivatecalendar@calendar.google.com/yourprivatekey
the following code changed "/" for "%2F" so the result became non-functional. I had to change the following code at the end of agenda.module

function _agenda_feed_url($googleid, $block) {

  $url = sprintf(AGENDA_SOURCEPATTERN,
    urlencode(check_plain($googleid)),
    date('Y-m-d', strtotime($block->start)),
    date('Y-m-d', strtotime($block->end)),
    $block->maxevents);

  return $url;
}

to

function _agenda_feed_url($googleid, $block) {

  $url = sprintf(AGENDA_SOURCEPATTERN,
    $googleid,
    date('Y-m-d', strtotime($block->start)),
    date('Y-m-d', strtotime($block->end)),
    $block->maxevents);

  return $url;
}

wich I know is not as secure, but as i know nothing of PHP, cant do better :)

Thanks for the module. It's a great work :)

Fran

aidanlis’s picture

This is fixed in D7, but the changes need to be backported to D6.

aidanlis’s picture

Status: Active » Needs work
Issue tags: -urlencode
aidanlis’s picture

Title: Allow viewing of private calendars » Allow viewing of private calendars (D6)
Status: Needs work » Postponed

I don't have time to backport this, but it's super easy so feel free to submit a patch.

jasenko_b’s picture

Hello, I am trying to get this working in Drupal 7, but so far no luck.

Question: if I use an e-mail from another domain name (info@mydomain.com for example) and this is coupled to a google calendar, is there something specific I need to look at? Will this work at all??

Thx in advance

  • aidanlis committed 83c1ed3 on 7.x-2.x
    Allow viewing of private calendars [#918512]
    
    
guschilds’s picture

Issue summary: View changes
Status: Postponed » Closed (duplicate)

There are now significant differences in the module (the 2.x releases) and the API it uses thanks to Google deprecating version 2 of their Calendar API. The approach needed to use private calendars is also different. A more recent discussion for that is happening in #2380761 so I'm going to close this as a duplicate.

guschilds’s picture

Version: 6.x-1.7 » 7.x-1.4
Status: Closed (duplicate) » Closed (fixed)

Actually, closing as fixed for 7.x-1.x because it was ;). Also, please ignore the commit in #17. That does not actually apply to the 7.x-2.x release.