• I’m using Event Organiser together with Contact Form 7 and pass the Name and Date of the Event in the contact mail. This worked fine until I updated my plugins. Now I’m getting this error:

    Fatal error: Uncaught exception ‘Exception’ with message Error in formating DateTime object. Expected DateTime, but instead given NULL in
    /wp-content/plugins/event-organiser/includes/event-organiser-utility-functions.php:31 Stack trace: #0
    /wp-content/plugins/event-organiser/includes/event-organiser-event-functions.php(641): eo format_datetime(NULL, ‘d. F Y’) #1
    /wp-content/themes/FreelancerThemeRes/functions.php(375): co_get_schedule_start(d. FY’,0) #2 [internal function]: getRefererPage(Array) #3
    /wp-includes/plugin.php(235): call_user_func_array(getRefererPage’, Array) #4
    /wp-content/plugins/contact-form-7/includes/shortcodes.php(168): apply filters(‘wpcf7 form tag’, Array, in
    /wp-content/plugins/event-organiser/includes/event-organiser-utility-functions.php on line 31

    I’ve been using this function to pass the date:

    <?php
    function getRefererPage( $form_tag )
    {
    if ( $form_tag[‘name’] == ‘referer-page’ ) {
    $referer = url_to_postid(wp_get_referer());
    $date = eo_get_schedule_start(‘d. F Y’, $referer);
    $passreferer = get_the_title($referer).’ am ‘.$date;
    $form_tag[‘values’][] = $passreferer;
    }
    return $form_tag;
    }
    if ( !is_admin() ) {
    add_filter( ‘wpcf7_form_tag’, ‘getRefererPage’ );
    }
    ?>

    The date is still correctly shown in the contact form but if I try to send it I get the error. When I erase eo_get_schedule_start everything works fine.

    I would really really appreciate it if someone could help me! Thank you very much!

    https://www.ads-software.com/plugins/event-organiser/

  • The topic ‘Error in formating DateTime object’ is closed to new replies.