• Resolved currentpatterns

    (@currentpatterns)


    This topic has appeared before, but there is no clear resolution in the prior ticket. I am flooded with error log entries for WordPress database error Not unique table/alias: ‘wp_tec_occurrences’. I have migrated to V6 and my configuration shows that the migration was completed successfully. This is NOT an issue of wp_tec_occurrences being absent. This is a badly formed query that JOINs wp_tec_occurrences *twice* but does not use aliases, so the system cannot determine which join it should be referring to when wp_tec_occurrences is referenced. Is there a solution in place for this recurring issue that others have also experienced?

    Thanks (error appears below)

    WordPress database error Not unique table/alias: ‘wp_tec_occurrences’ for query

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts

    LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)

    INNER JOIN wp_tec_occurrences ON wp_posts.ID = wp_tec_occurrences.post_id

    LEFT JOIN wp_pmpro_memberships_pages AS pmpro_mp_6 ON pmpro_mp_6.page_id = wp_posts.ID

    JOIN wp_tec_occurrences ON wp_posts.ID = wp_tec_occurrences.post_id
    WHERE 1=1 AND wp_posts.ID NOT IN (149,489,4361,4870,11,36,40,42,46,50,52,54,56,58,134,243,1435,1930,3006,3045,3122,3114,3259,3846,4691,4660,4754,4926,4934,5504,6116,6820,149,489,4361,4870,11,36,40,42,46,50,52,54,56,58,134,243,1435,1930,3006,3045,3122,3114,3259,3846,4691,4660,4754,4926,4934,5504,6116,6820) AND (
    wp_term_relationships.term_taxonomy_id IN (67)
    ) AND (
    CAST(wp_tec_occurrences.end_date AS DATETIME) < ‘2024-09-27 00:00:00’ ) AND wp_posts.post_type = ‘tribe_events’ AND ((wp_posts.post_status = ‘publish’)) AND (pmpro_mp_6.membership_id IS NULL)

    GROUP BY wp_tec_occurrences.occurrence_id

    ORDER BY wp_posts.post_date ASC LIMIT 0, 1

    made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/organic-natural/template-full.php’), get_header, locate_template, load_template, require_once(‘/themes/organic-natural/header.php’), wp_head, do_action(‘wp_head’), WP_Hook->do_action, WP_Hook->apply_filters, _wp_render_title_tag, wp_get_document_title, apply_filters(‘document_title_parts’), WP_Hook->apply_filters, Tribe\Events\Views\V2\Hooks->filter_document_title_parts, Tribe\Events\Views\V2\Template\Title->filter_document_title_parts, Tribe\Events\Views\V2\Template\Title->build_title, Tribe\Events\Views\V2\Template\Title->get_posts, Tribe\Events\Views\V2\View->get_html, Tribe\Events\Views\V2\Views\List_View->setup_template_vars, Tribe\Events\Views\V2\View->setup_template_vars, Tribe\Events\Views\V2\Views\List_View->prev_url, Tribe\Events\Views\V2\Views\List_View->get_past_url, Tribe__Repository->count, 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

    The page I need help with: [log in to see the link]

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

    (@jescandoit)

    Hi @currentpatterns

    Thank you for sharing your thoughts regarding this issue. We don’t have a work-around for it, and still gathering reports and information shared by our affected users in which I’ve added your case in the bug report [ECP-1562], so the team will be notified about it.

    Please fill out the following details regarding your set-up.
    WordPress version:
    PHP version:
    Theme info:
    The Events Calendar version:
    Event Calendar Pro version:

    We don’t have any timeframe on when we will release a permanent fix for it, but our team posts their updates and bug fixes in our?newsletter?and via our?changelog. I understand that this reply isn’t what you’re expecting at the moment, but no worries, we are doing our best to have this fixed as soon as possible.

    In the meantime, please let me know if I can help you with anything else.?

    bazmark

    (@bazmark)

    I have the same issue where PHP errors are written to the log file every time a user visits the events listing. In my case, it seems related to when the Paid Memberships Pro – Events Add On is activated. The errors are removed when this plug-in is deactivated, but the plug-in is required by our site to restrict events to Members.

    Plugin Support Darian

    (@d0153)

    Hi there,

    Once the fix is out, our team shares information about updates and bug fixes through our newsletter and via our changelog.

    We’ll be happy to help if any other questions come up about this topic. In the meantime, I’ll go ahead and close this ticket.

    Thread Starter currentpatterns

    (@currentpatterns)

    I have been doing some troubleshooting on this and I think I have isolated the error. I have submitted a pull request on TEC’s GitHub page and hopefully they will be able to evaluate my proposed solution in the near future.

    There are three separate instances where a JOIN clause is being created for table wp_tec_occurrences (which seems extreme):

    • The first instance is created via class WP_Query, function get_sql(); $clauses = $this->meta_query->get_sql( ‘post’, $wpdb->posts, ‘ID’, $this ). The meta_query get_sql () calls get_sql_clauses(), which calls get_sql_for_clauses(). The latter function is overridden by TEC class Custom_Table_Meta_Query extension, using get_sql_for_clauses() to create an INNER JOIN on wp_tec_occurrences. There is a check for duplicate clauses here (array $joined_tables), but only within the class. WP_Query later passes this INNER JOIN clause on via argument $join to the two callback functions described below.
    • The second instance is the result of WP_Query invoking a callback function for filter hook ‘posts_join’ using apply_filters_ref_array(). TEC class Custom_Tables_Query, an extension of WP_Query, creates the callback function join_occurrences_table(). This function reviews the $join parameter passed from WP_Query to make sure it does not add a duplicate join clause. If no duplicate is found, it adds the new clause to $join.
    • A third instance is invoked via the same filter hook described in Instance 2 (‘posts_join’). In this case, TEC class Tribe__Repository__Query_Filters, function join (), creates a callback for function filter_posts_join() using hook ‘posts_join’. TEC extension class Custom_Tables_Query_Filters overrides this function, using filters_post_join() to create another JOIN on wp_tec_occurrences. There is a check for duplicate clauses here (function deduplicate_joins()), but it only runs under certain conditions. The duplicate test is excluded when there are no existing redirects, even though this condition results in the creation of a new JOIN on wp_tec_occurrences. Regardless of the redirects count, deduplicate_joins() should be called prior to return if CTQF variable $query_vars[‘join’] is not empty.
    Plugin Support Darian

    (@d0153)

    Hi @currentpatterns

    Thank you for providing your insights on this matter. I want to assure you that I will promptly communicate this information to the team for their review.

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