• Resolved rileywebdev

    (@rileywebdev)


    I get this error in my php log every day. I noticed that I got about 14 of these last night and a few more when I logged into the website this morning. The errors I got last night were all logged over the course of about a minute. They all reference different post IDs (this one references ID 1580). The error occurs twice for each post ID: one error references tribe_the_next_event_link and the other error references tribe_the_prev_event_link. I have 24 events and none of them are designated as recurring events.

    I’ve tried saving all the posts as drafts then re-publishing them. I tried updating my single-event.php file with the most updated code. Any help is appreciated. I’ve also looked into my database and it appears all the events have valid start dates and end dates.

    This is one of the errors I’m getting:

    WordPress database error Incorrect DATETIME value: '' for query SELECT SQL_CALC_FOUND_ROWS (wp_asdfadsf_tec_occurrences.occurrence_id + 10000000) as occurrence_id FROM wp_asdfadsf_posts LEFT JOIN wp_asdfadsf_postmeta ON ( wp_asdfadsf_posts.ID = wp_asdfadsf_postmeta.post_id AND wp_asdfadsf_postmeta.meta_key = '_EventHideFromUpcoming' ) JOIN wp_asdfadsf_tec_occurrences ON wp_asdfadsf_posts.ID = wp_asdfadsf_tec_occurrences.post_id WHERE 1=1 AND ( CAST(wp_asdfadsf_tec_occurrences.start_date AS DATETIME) > '' AND wp_asdfadsf_postmeta.post_id IS NULL ) AND wp_asdfadsf_posts.post_type = 'tribe_events' AND ((wp_asdfadsf_posts.post_status = 'publish')) AND (wp_asdfadsf_posts.ID NOT IN (1580)) GROUP BY wp_asdfadsf_tec_occurrences.occurrence_id ORDER BY wp_asdfadsf_tec_occurrences.start_date ASC, wp_asdfadsf_posts.post_date ASC LIMIT 0, 1 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/web_theme/page-templates/page-full-width.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, Tribe\Events\Views\V2\Template\Page->filter_hijack_page_content, Tribe\Events\Views\V2\Template_Bootstrap->get_view_html, Tribe\Events\Views\V2\Template_Bootstrap->get_v1_single_event_html, tribe_get_view, include('/themes/web_theme_child/tribe-events/single-event.php'), tribe_the_next_event_link, tribe_get_next_event_link, Tribe__Events__Adjacent_Events->get_next_event_link, Tribe__Events__Adjacent_Events->get_event_link, Tribe__Events__Adjacent_Events->get_closest_event, WP_Query->get_posts, apply_filters_ref_array('posts_pre_query'), WP_Hook->apply_filters, TEC\Events\Custom_Tables\V1\WP_Query\Modifiers\Events_Only_Modifier->filter_posts_pre_query, TEC\Events\Custom_Tables\V1\WP_Query\Custom_Tables_Query->get_posts, WP_Query->get_posts

    • This topic was modified 1 year, 4 months ago by rileywebdev.
    • This topic was modified 1 year, 4 months ago by rileywebdev.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Darian

    (@d0153)

    Hi @rileywebdev

    I’m sorry to hear that you’re experiencing an issue. Could you please provide the URL of your events page where I can access your calendar? This will help me investigate the problem further on my end. Additionally, please let me know which version of The Events Calendar you are currently using.

    Looking forward to your reply.

    Thread Starter rileywebdev

    (@rileywebdev)

    Hi Darian,

    I’ve found out that removing the event header and footer in single-event.php prevents the error from popping up. Essentially, getting rid of tribe_the_prev_event_link and tribe_the_next_event_link solves the problem. This is the code I removed:

    Header:

    	<!-- Event header -->
    	<div id="tribe-events-header" <?php tribe_events_the_header_attributes() ?>>
    		<!-- Navigation -->
    		<nav class="tribe-events-nav-pagination" aria-label="<?php printf( esc_html__( '%s Navigation', 'the-events-calendar' ), $events_label_singular ); ?>">
    			<ul class="tribe-events-sub-nav">
    				<li class="tribe-events-nav-previous"><?php tribe_the_prev_event_link( '<span>&laquo;</span> %title%' ) ?></li>
    				<li class="tribe-events-nav-next"><?php tribe_the_next_event_link( '%title% <span>&raquo;</span>' ) ?></li>
    			</ul>
    			<!-- .tribe-events-sub-nav -->
    		</nav>
    	</div>
    	<!-- #tribe-events-header -->

    Footer:

    	<!-- Event footer -->
    	<div id="tribe-events-footer">
    		<!-- Navigation -->
    		<nav class="tribe-events-nav-pagination" aria-label="<?php printf( esc_html__( '%s Navigation', 'the-events-calendar' ), $events_label_singular ); ?>">
    			<ul class="tribe-events-sub-nav">
    				<li class="tribe-events-nav-previous"><?php tribe_the_prev_event_link( '<span>&laquo;</span> %title%' ) ?></li>
    				<li class="tribe-events-nav-next"><?php tribe_the_next_event_link( '%title% <span>&raquo;</span>' ) ?></li>
    			</ul>
    			<!-- .tribe-events-sub-nav -->
    		</nav>
    	</div>
    	<!-- #tribe-events-footer -->

    I’m using PHP 8.1, MySQL 8.0.33, WordPress 6.2.2.

    Viewing the events/venues on the frontend doesn’t trigger the error. Could this be related to a cron job? I can’t find any way to trigger the error, other than waiting for about a day — then it will pop up seemingly randomly. The error always comes in sets of two: one error mentions tribe_the_prev_event_link, and the other error mentions tribe_the_next_event_link. Sometimes just one set of errors shows up, sometimes its multiple sets, and sometimes more sets of errors pop up throughout the day.

    I’m using a custom single-event.php template but I’ve set it to the default code for this course of testing.

    I was able to prevent the error from popping up, but I want to keep the prev/next event buttons without it producing an error.

    • This reply was modified 1 year, 4 months ago by rileywebdev.
    Plugin Support Darian

    (@d0153)

    Hi @rileywebdev

    Thanks for providing additional information.

    Can you please provide me with the version of The Events Calendar that you are currently using, as well as the URL of your calendar page? I would like to investigate the issue on my end and assist you further.

    Looking forward to your reply.

    Plugin Support Darian

    (@d0153)

    Hi @rileywebdev

    I hope everything is going smoothly for you. I just wanted to touch base and inquire if you had the opportunity to review my previous response as it has been some time since we last heard from you.

    Plugin Support Darian

    (@d0153)

    Hi @rileywebdev

    It appears that we haven’t heard back from you in a while, so I’ll assume that the matter has been resolved. If you need any more help, feel free to start a new thread and we’ll be happy to assist you.

    I am seeing the same errors on https://www.investinmpl.org. WordPress 6.3.1, TEC 6.2.2, Events Calendar Pro 6.2.1, calendar page https://www.investinmpl.org/events/. I’ll paste a full sample error below. Thank you.

    Sep 27, 09:09:29
    
    WordPress database error Incorrect DATETIME value: '' for query
    SELECT SQL_CALC_FOUND_ROWS (wp_eg65rv_tec_occurrences.occurrence_id + 10000000) as occurrence_id
    FROM wp_eg65rv_posts LEFT JOIN wp_eg65rv_postmeta ON ( wp_eg65rv_posts.ID = wp_eg65rv_postmeta.post_id AND wp_eg65rv_postmeta.meta_key = '_EventHideFromUpcoming' )
    JOIN wp_eg65rv_tec_occurrences ON wp_eg65rv_posts.ID = wp_eg65rv_tec_occurrences.post_id
    WHERE 1=1 AND (
    CAST(wp_eg65rv_tec_occurrences.start_date AS DATETIME) > ''
    AND
    wp_eg65rv_postmeta.post_id IS NULL
    ) AND wp_eg65rv_posts.post_type = 'tribe_events' AND ((wp_eg65rv_posts.post_status = 'publish')) AND (wp_eg65rv_posts.ID NOT IN (182))
    GROUP BY wp_eg65rv_tec_occurrences.occurrence_id
    ORDER BY wp_eg65rv_tec_occurrences.start_date ASC, wp_eg65rv_posts.post_date ASC
    LIMIT 0, 1
    made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/the-events-calendar/src/views/v2/default-template.php'), Tribe\Events\Views\V2\Template_Bootstrap->get_view_html, Tribe\Events\Views\V2\Template_Bootstrap->get_v1_single_event_html, tribe_get_view, include('/plugins/the-events-calendar/src/views/single-event.php'), tribe_the_next_event_link, tribe_get_next_event_link, Tribe__Events__Adjacent_Events->get_next_event_link, Tribe__Events__Adjacent_Events->get_event_link, Tribe__Events__Adjacent_Events->get_closest_event, WP_Query->get_posts, apply_filters_ref_array('posts_pre_query'), WP_Hook->apply_filters, TEC\Events\Custom_Tables\V1\WP_Query\Modifiers\Events_Only_Modifier->filter_posts_pre_query, TEC\Events\Custom_Tables\V1\WP_Query\Custom_Tables_Query->get_posts, WP_Query->get_posts, QM_DB->query

    Hello, I have the same error ( WordPress database error Incorrect DATETIME value: ” ) which appears every day in my logs randomly and which does not necessarily concern the same event. Below is an excerpt from last night’s mistakes. Thank you for your help

    [08-Mar-2024 02:30:25 UTC] WordPress database error Incorrect DATETIME value: ” for query
    SELECT SQL_CALC_FOUND_ROWS (wptl04_tec_occurrences.occurrence_id + 10000000) as occurrence_id
    FROM wptl04_posts LEFT JOIN wptl04_postmeta ON ( wptl04_posts.ID = wptl04_postmeta.post_id AND wptl04_postmeta.meta_key = ‘_EventHideFromUpcoming’ )
    JOIN wptl04_tec_occurrences ON wptl04_posts.ID = wptl04_tec_occurrences.post_id
    WHERE 1=1 AND (
    CAST(wptl04_tec_occurrences.start_date AS DATETIME) < ” AND wptl04_postmeta.post_id IS NULL ) AND wptl04_posts.post_type = ‘tribe_events’ AND ((wptl04_posts.post_status = ‘publish’)) AND (wptl04_posts.ID NOT IN (70152)) GROUP BY wptl04_tec_occurrences.occurrence_id ORDER BY wptl04_tec_occurrences.start_date_utc DESC, wptl04_posts.post_date DESC LIMIT 0, 1 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/plugins/the-events-calendar/src/views/v2/default-template.php’), Tribe\Events\Views\V2\Template_Bootstrap->get_view_html, Tribe\Events\Views\V2\Template_Bootstrap->get_v1_single_event_html, tribe_get_view, include(‘/themes/citadela/tribe-events/single-event.php’), tribe_the_prev_event_link, tribe_get_prev_event_link, Tribe__Events__Adjacent_Events->get_prev_event_link, Tribe__Events__Adjacent_Events->get_event_link, Tribe__Events__Adjacent_Events->get_closest_event, WP_Query->get_posts, apply_filters_ref_array(‘posts_pre_query’), WP_Hook->apply_filters, TEC\Events\Custom_Tables\V1\WP_Query\Modifiers\Events_Only_Modifier->filter_posts_pre_query, TEC\Events\Custom_Tables\V1\WP_Query\Custom_Tables_Query->get_posts, WP_Query->get_posts

    I’m seeing a lot of  WordPress database error Incorrect DATETIME value: '' in the logs

    the full query looks like

    SELECT SQL_CALC_FOUND_ROWS (wp_tec_occurrences.occurrence_id + 10000000) as occurrence_id
    FROM wp_posts
    LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_EventHideFromUpcoming' )
      JOIN wp_tec_occurrences ON wp_posts.ID = wp_tec_occurrences.post_id 
    WHERE 1=1  
      AND (
         CAST(wp_tec_occurrences.start_date AS DATETIME) < ''
         AND wp_postmeta.post_id IS NULL
      ) 
      AND wp_posts.post_type = 'tribe_events'
      AND ((wp_posts.post_status = 'publish')) 
      AND (wp_posts.ID NOT IN (67146))
    GROUP BY wp_tec_occurrences.occurrence_id
    ORDER BY wp_tec_occurrences.start_date_utc DESC, wp_posts.post_date DESC
    LIMIT 0, 1 

    This is happening on requests for venue pages.

    The venue page is being treated as a single event, but this is causing get_closest_event() to construct a query that references _EventStartDate which is empty on venues.

    I think I can prevent the error by editing src/Tribe/Views/V2/Template_Bootstrap.php and removing the line tribe_context()->get( 'tec_post_type' ), from is_single_event()

    this is the-events-calendar=6.6.0.2

    • This reply was modified 3 months, 3 weeks ago by leedxw.

    Thanks for your answer. I will try your solution

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.