• Resolved saso

    (@saiso)


    Hi,

    I am using Tribe events tickets + tickets pro plugins. This code snippet in my woocommerce email-template.php to add Google Calendar, Outlook calendar and Icalendar links.

    The links appear correctly in an email but the date and time is obviously not fetched. When I click the +Google calendar link, the date and time data of the event is not loaded correctly in Google Calendar. I need some help with tweaking this code to make it work.

    /**
    
    ?* Export buttons for Google, Outlook, and iCalendar.
    
    ?*/
    
    if (!class_exists('Tribe__Events__Main')) {
      return;
    }
    
    $event_id = get_post_meta($order->get_id(), '_tribe_event_id', true);
    $post = get_post($event_id);
    
    if (empty($post)) {
      return;
    }
    
    // Get event time and date
    $start_date = get_post_meta($event_id, '_EventStartDate', true);
    $start_time = get_post_meta($event_id, '_EventStartDate', true);
    $end_date = get_post_meta($event_id, '_EventEndDate', true);
    $end_time = get_post_meta($event_id, '_EventEndDate', true);
    
    // Format the time and date as needed
    $formatted_start_date = date('Y-m-d', strtotime($start_date));
    $formatted_start_time = date('H:i:s', strtotime($start_time));
    $formatted_end_date = date('Y-m-d', strtotime($end_date));
    $formatted_end_time = date('H:i:s', strtotime($end_time));
    
    $ical_link = add_query_arg(
      array(
        'ical' => '1',
        'start_date' => $formatted_start_date,
        'start_time' => $formatted_start_time,
        'end_date' => $formatted_end_date,
        'end_time' => $formatted_end_time
      ),
      get_the_permalink($post->ID)
    );
    
    
    $google_calendar_link = Tribe__Events__Main::instance()->esc_gcal_url(tribe_get_gcal_link());
    
    $outlook_calendar_link = 'https://outlook.live.com/calendar/0/deeplink/compose?path=/calendar/action/compose&rru=addevent';
    
    $calendar_links = '<div class="tribe-events-cal-links">';
    $calendar_links .= '<a class="tribe-events-gcal tribe-events-button" href="' . $google_calendar_link . '" target="_blank" rel="noopener noreferrer" title="' . esc_attr__('Dodaj v Google koledar', 'the-events-calendar') . '">+ ' . esc_html__('Google koledar', 'the-events-calendar') . '</a> ';
    $calendar_links .= '<a class="tribe-events-outlook tribe-events-button" href="' . $outlook_calendar_link . '" target="_blank" rel="noopener noreferrer" title="' . esc_attr__('Dodaj v Outlook koledar', 'the-events-calendar') . '">+ ' . esc_html__('Outlook koledar', 'the-events-calendar') . '</a> ';
    $calendar_links .= '<a class="tribe-events-ical tribe-events-button" href="' . esc_url($ical_link) . '" title="' . esc_attr__('Prenesi .ics file', 'the-events-calendar') . '">+ ' . esc_html__('iCalendar', 'the-events-calendar') . '</a>';
    $calendar_links .= '</div><!-- .tribe-events-cal-links -->';
    
    echo '<div style="margin-top: 20px;"></div>'; // Add a space before the calendar links block
    echo $calendar_links;

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support masoodak

    (@masoodak)

    Hi @saiso,

    Thanks for reaching out!

    It appears that you have an active license, and in order for us to provide you with the best assistance possible, we kindly request that you open a Support Ticket on our Help Desk. This also adheres to WordPress Community guidelines when it comes to our premium users.

    We are eager to assist you with this matter.

    Kind regards,
    Masood

    Thread Starter saso

    (@saiso)

    Hi Masood,

    yes indeed we have an active licence but unfortunately we are unable to access our account because it was generated by previous admin and he does not want to share his login information. We intend to buy a new licence in august 2023 when our current licence expires and generate a new account with Tribe Events Calendar. Is there any way we can solve this date and time fetch without opening a Support Ticket on your Help Desk?

    Kinde Regards,

    Sa?o

    Plugin Support Darian

    (@d0153)

    Hi @saiso

    Thanks for your message. Unfortunately, we cannot provide support in this forum for premium users.

    If you don’t have access to your TEC account, you can send a Pre-Sales question and indicate your license key in your message for us to confirm your license.

    See- https://share.getcloudapp.com/wbuLJzQ5

    Thread Starter saso

    (@saiso)

    Hi Darian,

    I have successfully opened a ticket as instructed.

    Thank you.

    Sa?o

    Plugin Support Darian

    (@d0153)

    Hi Sa?o,

    Thanks for your response.

    I’d be closing this thread, and please do not hesitate to open a Support Ticket on our Help Desk if you have other questions or concerns.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add to google calendar link (fetch date and time)’ is closed to new replies.