Support

Home Forums Event Espresso Premium Add to google calendar

Add to google calendar

Posted: June 9, 2013 at 8:28 pm

Viewing 15 reply threads


Von Nostrand

June 9, 2013 at 8:28 pm

Hi Guys

Looking over previous threads it looks like it has been asked before but I couldn’t find any solutions?
Is there a way to add a  “add to google calendar” link similar to Ical on the registration page?

It looks like the link seems simply enough below. I am not a coder but I guess you would pass the event variables into it somehow

<a href=”http://www.google.com/calendar/event?action=TEMPLATE&amp;text=Your%20Event%20Name&amp;dates=20130614T230000Z/20130614T183000Z&amp;details=&amp;location=Venue%20Name%20Here&amp;trp=false&amp;sprop=Business%20Name%20Here&amp;sprop=name:www.yourbusinessname.com&#8221; target=”_blank”><img alt=”” src=”//www.google.com/calendar/images/ext/gc_button1.gif” border=”0″ /></a>

thanks for your help, cheers

 


Dean

June 10, 2013 at 4:41 am

Hi,

Well, as you have probably discovered you can manually add links into the event description using this https://support.google.com/calendar/answer/3033039 to generate a button.

Converting it over to something coded is a little harder.

I have made this here https://gist.github.com/Apina/273425ce2c2c62af6d17 but I can tell you now it is not perfect, especially the time, as Google Calendar seems to work on a GMT/UTC basis, and I couldnt get my head around how to get that working.

Perhaps by opening it up here, others may be able to assist in getting that bit working.


Von Nostrand

June 10, 2013 at 4:48 am

Hi Dean

Thanks for the reply.

Yes, preferably I would like this dynamic as creating links to many events would become quite laborious.

I did think the time format would be a little tricky just looking at it. Anyway I hope someone steps in. It would be a great feature for EE I think in addition to the ical as I and many others use Google calendar as their main e-calendar and it would be great to offer the choice.

cheers

Von


Dean

June 11, 2013 at 3:10 am

Hi,

I updated the gist.

I think I have it now. In my tests if I set WordPress time to New York, and have an event that starts at 2am there, it shows (correctly) as 9am for me in Google Calendar. If I swap the time to Helsinki then that same 2am event correctly shows as 2am for me in Google Calendar.

Would love it if you could test it a bit and make sure that it is doing as planned.


Von Nostrand

June 11, 2013 at 3:30 am

Hi Dean

thanks for your help and time with this one. I gave it a try out and for some reason it isn’t working too well for me. I am still on 3.1.32.2.P, not sure if that should make a difference. Anyway here is the url it is outputting. As you can see org name and website is parsed but I get a 1970’s date and no location or event name

http://www.google.com/calendar/event?action=TEMPLATE&text=&dates=19700101T000000Z/19700101T000000Z&details=&location=,,,,,,,&trp=false&sprop=My%20Business%20Name&sprop=name:http://www.mywebsite.com

cheers


Dean

June 11, 2013 at 3:44 am

Hi,

Thanks for that. OK, i will have another look at it. I believe the location may be down to whether you are using the Venue Manager or not (it needs it).

Not sure why the name isnt working for you. What date format are you using (eg, 31/12/2013, 12/31/2013, etc)?


Von Nostrand

June 11, 2013 at 3:46 am

Hi Dean

Yes I am using venue manager.

I am using dd/mm/yy (the proper date format of course ; )

 


Sidney Harrell

June 11, 2013 at 7:38 am

The gist works when placed in the event_list_display.php, but in the registration_page_display.php, the $event object is not available. I’m trying some modifications now to see if I can get around that.


Sidney Harrell

June 11, 2013 at 10:21 am

I made the promised modifications:
https://gist.github.com/sidharrell/5758246
but while digging into it, I discovered that the $event object should have been visible to the reg_page_display template. Indeed, when I changed the “require” statements at the end of the reg_page template file to be “include” statements instead, like the event_list template file uses for the event_list_display template, the $event object was suddenly available. Even stranger, when I switched them back to “require” statements to test that that was the problem, the $event object remained visible. It seems like a very peculiar bug in php’s interpreter, but it produced the same output from Dean’s original gist as what you posted, so it may be affecting you as well. In any case, the modified code in the gist above should get around the problem.


Von Nostrand

June 11, 2013 at 3:11 pm

Hi Guys

Great work so far. I did a few tests on the code. Here is what I found

It doesn’t work for me currently with my custom date format as d/m/y. It also doesn’t work with date set as d/m/Y. I still get the 1970’s date as per above

When I switch WP settings to m/d/Y it works but for some reason I get a day added to the start date and the end date displays correctly. I.e if the event date was 6/15/13 the google event would display start date 6/16/13 and the end date as 6/15/13. I double checked my event, and both start and end dates were set as 6/15/13.  All other details are correct parsed to google though including times, venue, description etc

It seems funny to me that it’s not working with the d/m/Y format it looks like you are extracting the day, month and year separately and rejoining them for google.

thanks once again

 

 

 


Sidney Harrell

June 12, 2013 at 6:31 pm

I did some changes to the gist to make it work with any date format:
https://gist.github.com/sidharrell/5758246


Dean

June 13, 2013 at 3:15 am

And another update. https://gist.github.com/Apina/273425ce2c2c62af6d17

After working with Sidney, we found the variables needed changing a little and strip HTML out of the description.

I have found no issues now with EU or other date formats than US, and also the weird day ahead/behind thing should be resolved.


Von Nostrand

June 13, 2013 at 5:15 am

wow thanks guys for your time.

I tried out the latest version and for some reason I am still getting the start date +1 day problem. I am not sure what’s going on, perhaps it is just my setup? I tried both system date setups of d/m/y and d/m/Y (not sure if it affects the code?) and get the same error.


Dean

June 13, 2013 at 5:57 am

Hey

No worries, it’s taking longer than I thought it would but i think it would be a nice cool addition to the plugin.

Do you have an example page we could look at showing the issue? Can you also advise what the dates should be here as well as we had one problem where the post dates were being modified incorrectly.


Von Nostrand

June 13, 2013 at 6:21 am

Hi Dean

just so my website url isnt displayed here,  I have just sent a email through to sales@ with details, hopefully they can forward to you, cheers

The other idea I had for this one was to have the link on the payment overview page, just so it doesn’t disrupt the flow of the customer completing form and payment, i.e save it for the end when the purchase has been made

 

 


Jonathan Wilson

June 13, 2013 at 1:36 pm

Hi Von,

We have received your email and forwarded it to Dean.

Viewing 15 reply threads

The support post ‘Add to google calendar’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso