Problem with Google Calendar link

Home Forums Calendar Products Events Calendar PRO Problem with Google Calendar link

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #953238
    Gilles
    Participant

    Hello,

    I am having trouble with the Google Calendar link for events. Below is what the link looks like. It seems that there is way too much stuff in there. Are you using the excerpt() function to pass the event description to the Google calendar? I have customized it because I need to keep some of the formatting.

    In comparison, the iCal export link works perfectly:
    http://test.wednesdaynighthop.com/event/20150415/?ical=1&tribe_display=

    I just need to know if that’s the case. If so, I will fix this up myself.

    Thank you,
    Gilles

    http://www.google.com/calendar/event?action=TEMPLATE&text=April+15%2C+2015+-+Theme+Party%3A+Spring+Festival&dates=20150415T213000/20150416T000000&details=%3Cdiv+class%3D%22vc_row+wpb_row+vc_row-fluid%22%3E++++%3Cdiv+class%3D%22vc_row-fluid+clr+vc_row-fluid%22%3E++++++++++++++++++++%09%3Cdiv+class%3D%22vc_col-sm-2+vc_col-xs-12+wpb_column+clr+column_container++%22+style%3D%22margin-top%3A15px%3Bmargin-bottom%3A20px%3B%22%3E%09%09%09%09%3Cdiv+class%3D%22wpb_text_column+wpb_content_element+%22%3E%09%09%3Cdiv+class%3D%22wpb_wrapper%22%3E%09%09%09%3Cdiv+class%3D%22vcex-recent-news-date+my-news-date%22%3E%3Cspan+class%3D%22day%22+style%3D%22font-weight%3A500%22%3E15%3C%2Fspan%3E%3Cspan+class%3D%22month%22+style%3D%22font-weight%3A700%22%3EApr%3C%2Fspan%3E%3C%2Fdiv%3E%09%09%3C%2Fdiv%3E+%09%3C%2Fdiv%3E+%09%3C%2Fdiv%3E+%09%3Cdiv+class%3D%22vc_col-sm-10+vc_col-xs-12+wpb_column+clr+column_container++%22+style%3D%22margin-bottom%3A10px%3B%22%3E%09%09%09%09%3Cdiv+class%3D%22wpb_text_column+wpb_content_element+%22%3E%09%09%3Cdiv+class%3D%22wpb_wrapper%22%3E%09%09%09%3Cp%3EGood-bye+dark+cold+winter+days%2C+hello+warmth%2C+sun%2C+and+new+green+vegetation%21+Spring%2C+the+season+of+love+and+fresh+beginnings%2C+is+finally+here%2C+and+we+want+to+greet+it+with+our+Spring+Festival.+Bring+your+laughter+and+joy%2C+give+a+hug+to+an+old+friend%2C+and+be+ready+to+make+a+new+one%21%3C%2Fp%3E%09%09%3C%2Fdiv%3E+%09%3C%2Fdiv%3E+%09%3C%2Fdiv%3E+++++++++++++++++++++++++++++++++++++++++++++++++++++%3C%2Fdiv%3E%3C%21–+.vc_row-fluid+clr+vc_row-fluid+–%3E++++%3C%2Fdiv%3E%3C%21–+.vc_row+wpb_row+vc_row-fluid+–%3E%3Cdiv+class%3D%22vc_row+wpb_row%22%3E++++%3Cdiv+class%3D%22vc_row-fluid+clr%22%3E++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%3C%2Fdiv%3E%3C%21–+.vc_row-fluid+clr+–%3E++++%3C%2Fdiv%3E%3C%21–+.vc_row+wpb_row+–%3E%09%3Cdiv+class%3D%22vc_col-sm-12+wpb_column+clr+column_container++%22+style%3D%22margin-bottom%3A0px%3B%22%3E%09%09%09%09%3C%2Fdiv%3E+%09%3Cdiv+class%3D%22wpb_text_column+wpb_content_element+%22%3E%09%09%3Cdiv+class%3D%22wpb_wrapper%22%3E%09%09%09%09%09%3C%2Fdiv%3E+%09%3C%2Fdiv%3E+Together+we%26%238217%3Bll+play+some+%26%238220%3Blawn%26%238221%3B+games%2C%C2%A0win+heartwarming+prizes%2C+and+of+course+we%26%238217%3Bll+dance%2C+dance%2C+dance%21+And+how+about+adding+some+spring-themed+colors+and+prints+to+our+outfits%3F+Let%26%238217%3Bs+make+our+dance+floor+look+like+%28View+Full+Event+Description+Here%3A+http%3A%2F%2Ftest.wednesdaynighthop.com%2Fevent%2F20150415%2F%29%3C%2Fp%3E&location=1400+N.+Shoreline+Blvd+%23A-1%2C+Mountain+View%2C+CA%2C+94043%2C+United+States&sprop=website:http://test.wednesdaynighthop.com&trp=false

    #953356
    George
    Participant

    Hey Giles,

    The “Export to Google” links indeed usually look quite long, because the link is sending a whole description to Google to populate its “Event description” textarea.

    Though long, and maybe a little ugly admittedly, the links should work fine. The customizations you’ve made seem to be the source of your problems here.

    We don’t offer support for customizations, but I’d happy to take a quick look into things see what’s going on here first before simply turning you away!

    So with that in mind: what specific customizations have you made so far? Have you edited core plugin files of The Events Calendar?

    If you can post your customizations – in un-edited, whole files – in various Gist at http://gist.github.com, then share links to those Gists so we can look through some of your custom code, we might be able to recommend some tweaks to improve the compatibility of your tweaks.

    Thanks!
    George

    #953657
    Gilles
    Participant

    Hmm things start to work again without my doing anything. Well okay I have been working on the site continuously so it’s possible I fixed it inadvertently. Or maybe google was having an issue, not sure.

    Anyway, I’ve noticed that exporting a recurring event does not make it recurring on google. Seems like a bug or am I using the wrong link?

    Gilles

    PS: My first name has two Ls in it 🙂

    #953658
    Gilles
    Participant

    I also see a number of formatting issues:

    “…
    You might think we’ll be baking, with moves that include words like “roll” and “sugar”, and you won’t
    …”

    Google calendar does not support HTML so after you call get_the_content(), it would be great to pass it through an HTML to text converter.

    Gilles

    #953659
    Gilles
    Participant

    One last thing for today, it would be great if the additional fields could be included too.

    Gilles

    #953661
    Gilles
    Participant

    Okay I have one more. It would be great if there was a filter on this line of wp-content/plugins/the-events-calendar/lib/the-events-calendar.class.php:

    $event_details = get_the_content();

    Then I could easily manipulate the content myself, e.g. I could remove the html tags.

    Gilles

    #954337
    George
    Participant

    Hey Gilles,

    First of all, sorry about missing that extra “L” in your name! 🙂

    Next, I think we should try and narrow down the scope of your issues here, as there are several different questions you’ve asked:

    Anyway, I’ve noticed that exporting a recurring event does not make it recurring on google. Seems like a bug or am I using the wrong link?

    Exporting one event to Google Calendar does not let Google Calendar know that it’s a recurring event, so it doesn’t happen automatically, but you should still be able to very easily set up a recurring event once you export it to Google. When you export an event from The Events Calendar’s gCal export link, you should be able to click a “Repeat” checkbox, as shown in this screenshot → https://cloudup.com/c3IRtaLOsMx

    If you click that, you should be met with a recurrence options form that is quite similar to the one within The Events Calendar itself, here’s a screenshot of how it looks → https://cloudup.com/cv2Q0mAu9cK

    You should then be able to set up the recurrence there with the same settings as on your WordPress site and have it work fine. Let us know if this is not the case!

    Google calendar does not support HTML so after you call get_the_content(), it would be great to pass it through an HTML to text converter.

    By your question here, do you mean that you’re hoping for a way to have basic HTML like bold text, italicized text, embedded links, etc. right within the Google Calendar description box? If so, we agree with you and share your desire for such functionality. However, there is no way to enable this, and we’ve spent hours over time applying different filters to the gCal export URL to achieve different things – embedded HTML is unfortunately not possible at this time. If you mean something else, can you elaborate on what you mean a little bit more?

    One last thing for today, it would be great if the additional fields could be included too.

    This is technically possible, though a bit beyond the scope of our support forums – let’s clear up all your other questions here first, leaving this as the only thing here, then I can share some example code on how to do this.

    Okay I have one more. It would be great if there was a filter on this line of wp-content/plugins/the-events-calendar/lib/the-events-calendar.class.php: $event_details = get_the_content(); Then I could easily manipulate the content myself, e.g. I could remove the html tags.

    This is good feedback and appreciated – it’s definitely something to consider. In the meantime, if you’re trying to remove HTML tags, we offered some code examples to do this in this other forum post here → https://theeventscalendar.com/support/forums/topic/html-code-showing-in-description-when-event-exported-to-google-calendar/

    Definitely check that out and let us know if it helps!

    Thanks Gilles!

    #954728
    Gilles
    Participant

    Hi George,

    Thanks for the reply. I understand it’s easy to “fix up” the google calendar event. It is sad that Google does not allow setting recurring events through url. I do understand it is a bit of a tricky situation but it can be done with ics files, so I don’t see why it couldn’t be done with urls too. Anyway I guess they are investing in a true API to give users better access and get more control and visibility on their side. I hope you have the time at some point to switch to supporting the API.

    Thank you for pointing me to the other post. There is some really interesting coding in there. Below is what I came up with on my own (and some help from the interwebs). There is a code specific to my custom fields.

    I appreciate the detailed support!

    Gilles

    // Remove html tags from google calendar export
    add_filter(‘tribe_google_calendar_parameters’, ‘my_tribe_google_calendar_parameters’, 10, 1);
    function my_tribe_google_calendar_parameters ($params) {
    $event_details = urldecode($params[‘details’]);

    // First, replace UTF-8 characters.
    $event_details = str_replace(
    array(“\xe2\x80\x98”, “\xe2\x80\x99”, “\xe2\x80\x9c”, “\xe2\x80\x9d”, “\xe2\x80\x93”, “\xe2\x80\x94”, “\xe2\x80\xa6”),
    array(“‘”, “‘”, ‘”‘, ‘”‘, ‘-‘, ‘–‘, ‘…’),
    $event_details);
    // Next, replace their Windows-1252 equivalents.
    $event_details = str_replace(
    array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)),
    array(“‘”, “‘”, ‘”‘, ‘”‘, ‘-‘, ‘–‘, ‘…’),
    $event_details);

    $event_details = preg_replace(“/(<\/p>)/”, ‘$1’.”\n”, $event_details);
    $event_details = trim(strip_tags($event_details));
    $event_details = preg_replace(“/(we|you|they)’re/”, ‘$1 are’, $event_details);
    $event_details = preg_replace(“/(I)’m/”, ‘$1 am’, $event_details);
    $event_details = preg_replace(“/(she|he)’s/”, ‘$1 is’, $event_details);
    // remove empty lines
    $event_details = preg_replace(“/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/”, “\n\n”, $event_details);

    $event_details = preg_replace(‘/(PRE-REQUISITES:)/’, “\n# “.’$1′, $event_details);

    $fields = tribe_get_custom_fields( get_the_ID() );
    foreach ( $fields as $label => $value ) {
    $value = trim(strip_tags($value));
    if ($label == ‘Instructor 1’) {
    $title = urldecode($params[‘text’]);
    $title .= ‘ w/ ‘.strtok($value,’ ‘);
    $params[‘text’] = urlencode($title);
    } elseif ($label == ‘Instructor 2’) {
    $title = urldecode($params[‘text’]);
    $title .= ‘ & ‘.strtok($value,’ ‘);
    $params[‘text’] = urlencode($title);
    } else {
    $event_details .= “\n\n$label: $value”;
    }
    }

    $event_details = urlencode($event_details);
    $event_details = preg_replace(‘/%26%238230%3B/’, str_repeat(urlencode(‘.’), 3), $event_details);
    $params[‘details’] = $event_details;

    return $params;
    }

    #954789
    George
    Participant

    Hey Gilles,

    Thanks for the kind words, and for being cool about my original mistake with your name! 🙂

    If your code works well for you, I’m glad that’s the case – be sure to make a backup of this code, and/or at least a bookmark of this forum thread, so you don’t risk losing that code if you auto-update your theme or something on your site.

    Your comments about Google’s API changes are indeed quite true – we agree about hoping for a more robust set of features from them, and have our eyes on it! We’ll see what the future has in store.

    Best of luck with your project Gilles, cheers!
    George

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Problem with Google Calendar link’ is closed to new replies.