strangerstudios / pmpro-events

Offer members-only events using popular events plugins and Paid Memberships Pro.
https://www.paidmembershipspro.com/add-ons/events-for-members-only/
8 stars 10 forks source link

After migrating events to The Events Calendar 6.0.1.1, no events are displayed on the front end #47

Closed ncmnancy closed 9 months ago

ncmnancy commented 1 year ago

After migrating events to The Events Calendar 6.0.1.1, no events are displayed on the front end. This applies to events available to all users.

Query Monitor shows that seven database errors are occurring. They all say "Unknown column 'pmpro_mp.membership_id' in 'where clause'". I did more troubleshooting and found that the JOIN clause linking wp_pmpro_memberships_pages to other tables is missing from the query assembled in modules/the-events-calendar.php in pmpro_events_tribe_events_repository_handle_posts().

When I experimented in the database and added the missing JOIN clause to one of the queries that had failed, it worked. Here's the query that worked.

SELECT wp_posts.ID, CAST( wp_tec_occurrences.start_date_utc AS DATETIME ) AS event_date_utc, CAST( wp_tec_occurrences.duration AS DECIMAL ) AS event_duration
FROM wp_posts
LEFT JOIN wp_postmeta
ON ( wp_posts.ID = wp_postmeta.post_id
AND wp_postmeta.meta_key = '_EventHideFromUpcoming' )
LEFT JOIN wp_tec_occurrences
ON wp_posts.ID = wp_tec_occurrences.post_id
LEFT JOIN wp_pmpro_memberships_pages AS pmpro_mp
            ON (pmpro_mp.page_id = wp_posts.ID)
WHERE 1=1
AND ( wp_postmeta.post_id IS NULL
AND CAST(wp_tec_occurrences.end_date_utc AS DATETIME) > '2021-10-06 18:40:06' )
AND wp_posts.post_type = 'tribe_events'
AND ((wp_posts.post_status = 'publish'
OR wp_posts.post_status = 'private'))
AND (pmpro_mp.membership_id IS NULL
OR pmpro_mp.membership_id IN ( 1 ))
ORDER BY wp_tec_occurrences.start_date_utc ASC, wp_tec_occurrences.duration ASC, wp_posts.post_date ASC
LIMIT 0, 13

This site has a lot of plugins. I disabled nearly all of them and the issue persisted.

Environment/WP/Server info:

WordPress version
6.0.2

PHP version
7.4.32

PHP
max_execution_time = 120
memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
display_errors = 1
log_errors = 1
Server
nginx
SAPI
fpm-fcgi

Plugins
Query Monitor version 3.10.1 by [John Blackbourn](https://querymonitor.com/) (https://querymonitor.com/)
Native PHP Sessions for WordPress version 1.2.4 by [Pantheon](https://www.pantheon.io/) (https://www.pantheon.io/)
Advanced Custom Fields version 5.12.3 by [Delicious Brains](https://www.advancedcustomfields.com/) (https://www.advancedcustomfields.com)
bbPress Notify (No-Spam) Reply by Email version 2.6.6 by [Vinny Alves (UseStrict Consulting)](http://usestrict.net/)
bbPress Notify (No-Spam) version 2.17.6 by [Vinny Alves (UseStrict Consulting)](http://usestrict.net/)
bbPress version 2.6.9 by [The bbPress Contributors](https://bbpress.org/) (https://bbpress.org)
Code Snippets version 3.2.0 by [Code Snippets Pro](https://codesnippets.pro/) (https://codesnippets.pro)
Content Control version 1.1.9 by [Code Atlantic](https://code-atlantic.com/) (https://code-atlantic.com/)
Disable Emails version 1.8.1 by [WebAware](https://shop.webaware.com.au/) (https://shop.webaware.com.au/)
Do Not Cache version 0.3 by [Nancy Brauer](https://insidenewcity.com/) (https://insidenewcity.com)
Yoast Duplicate Post version 4.5 by [Enrico Battocchi & Team Yoast](https://yoast.com/) (https://yoast.com)
GTM4WP version 1.16.1 by [Thomas Geiger](https://gtm4wp.com/) (https://gtm4wp.com/)
Elementor version 3.7.8 by [Elementor.com](https://elementor.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash) (https://elementor.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash)
Event Tickets version 5.5.1 by [The Events Calendar](https://evnt.is/1aor) (https://evnt.is/1aor)
Force First and Last Name as Display Name version 1.2 by [Stranger Studios](https://www.strangerstudios.com/) (https://www.strangerstudios.com)
GA Google Analytics version 20221002 by [Jeff Starr](https://plugin-planet.com/) (https://plugin-planet.com/)
Import and export users and customers version 1.20.4 by [codection](https://codection.com/) (https://codection.com)
Jupiter X Core version 2.5.2 by [Artbees](https://artbees.net/) (https://artbees.net)
Login as User version 1.4.4 by [Web357](https://www.web357.com/) (https://www.web357.com/)
Login Logout Menu version 1.3.3 by [WPBrigade](https://wpbrigade.com/?utm_source=login-logout-menu) (https://WPBrigade.com/?utm_source=login-logout-menu)
Paid Memberships Pro version 2.9.5 by [Paid Memberships Pro](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Paid Memberships Pro - Add Member From Admin version 0.7.1 by [Stranger Studios](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Paid Memberships Pro - Add Name to Checkout Add On version 0.6.0 by [Stranger Studios](http://www.strangerstudios.com/) (http://www.strangerstudios.com)
Paid Memberships Pro - Address For Free Levels Add On version 0.5 by [Paid Memberships Pro](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com/)
Paid Memberships Pro - Advanced Levels Page Shortcode Add On version .2.4 by [Stranger Studios](http://www.strangerstudios.com/) (http://www.strangerstudios.com)
Paid Memberships Pro - Approvals Add On version 1.4.3 by [Stranger Studios](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Paid Memberships Pro - bbPress Add On version 1.7.3 by [Paid Memberships Pro, Scott Sousa](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Paid Memberships Pro - Events Add On version 1.3.1 by [Paid Memberships Pro](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Paid Memberships Pro - Member Directory Add On version 1.2.3 by [Paid Memberships Pro](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com/)
Paid Memberships Pro - Nav Menus Add On version .3.4 by [Stranger Studios](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Paid Memberships Pro - Pay by Check Add On version 0.11 by [Stranger Studios](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Paid Memberships Pro - Recurring Emails Add On version .5.4 by [Stranger Studios, Thomas Sjolshagen ](http://www.strangerstudios.com/)(http://www.strangerstudios.com)
Paid Memberships Pro - Register Helper Add On version 1.8 by [Paid Memberships Pro](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Paid Memberships Pro - Set Expiration Dates Add On version 0.6.1 by [Stranger Studios](http://www.strangerstudios.com/) (http://www.strangerstudios.com)
Paid Memberships Pro - State Dropdowns Add On version 0.3 by [Paid Memberships Pro](https://www.paidmembershipspro.com/) (https://www.paidmembershipspro.com)
Redirection version 5.3.4 by John Godley
Safe SVG version 2.0.3 by [10up](https://10up.com/) (https://10up.com)
The Events Calendar version 6.0.1.1 by [The Events Calendar](https://evnt.is/1x) (https://evnt.is/1x)
Yoast SEO version 19.7.2 by [Team Yoast](https://yoa.st/1uk) (https://yoa.st/1uk)
WP Job Manager version 1.38.0 by [Automattic](https://wpjobmanager.com/) (https://wpjobmanager.com/)
WP Mail SMTP Pro version 3.6.1 by [WPForms](https://wpforms.com/) (https://wpforms.com/)
WP Redis version 1.2.0 by [Pantheon, Josh Koenig, Matthew Boynes, Daniel Bachhuber, Alley Interactive](https://pantheon.io/) (https://pantheon.io/)
Sponsors version 3.5.0 by [Simple Sponsorships](http://www.wpsimplesponsorships.com/) (http://www.wpsimplesponsorships.com)
WPForms Lite version 1.7.7.1 by [WPForms](https://wpforms.com/) (https://wpforms.com)
Network Plugins
-
MU Plugins
Pantheon version 0.3 by Pantheon (https://pantheon.io/)
Theme
JupiterX Child
Multisite
-
Views V2 Status
Enabled
Custom Tables Migration Status
Completed
Settings
did_init = 1
tribeEventsTemplate =
tribeEnableViews =
Array
(
    [0] => list
    [1] => month
)
viewOption = list
schema-version = 6.0.1.1
recurring_events_are_hidden = hidden
previous_ecp_versions =
Array
(
    [0] => 0
    [1] => 5.8.1
    [2] => 5.8.2
    [3] => 5.9.0
    [4] => 5.9.1
    [5] => 5.9.2
    [6] => 5.10.0
    [7] => 5.10.1
    [8] => 5.11.0
    [9] => 5.12.0
    [10] => 5.12.2
    [11] => 5.12.3
    [12] => 5.12.4
    [13] => 5.13.0
    [14] => 5.14.0.2
    [15] => 5.14.0.4
    [16] => 5.14.1
    [17] => 5.14.2.1
    [18] => 5.16.0
    [19] => 5.16.1.1
    [20] => 5.16.2
    [21] => 5.16.2.1
    [22] => 5.16.3.1
    [23] => 5.16.4
    [24] => 6.0.0.1
    [25] => 6.0.1
)
latest_ecp_version = 6.0.1.1
views_v2_enabled = 1
postsPerPage = 12
monthEventAmount = 3
last-update-message-the-events-calendar = 6.0.1.1
ticket-enabled-post-types =
Array
(
    [0] => page
    [1] => tribe_events
)
event-tickets-schema-version = 5.5.1
previous_event_tickets_versions =
Array
(
    [0] => 0
    [1] => 5.1.7
    [2] => 5.1.8
    [3] => 5.1.9
    [4] => 5.1.9.1
    [5] => 5.1.10
    [6] => 5.2.0.1
    [7] => 5.2.1
    [8] => 5.2.2
    [9] => 5.2.3
    [10] => 5.2.4.1
    [11] => 5.3.0.1
    [12] => 5.3.1
    [13] => 5.3.2
    [14] => 5.3.3
    [15] => 5.4.0.1
    [16] => 5.4.1
    [17] => 5.4.2
    [18] => 5.4.2.1
    [19] => 5.4.3.1
    [20] => 5.4.4
    [21] => 5.5.0
)
latest_event_tickets_version = 5.5.1
tribe_tickets_migrate_offset_ = complete
last-update-message-event-tickets = 5.2.1
front_page_event_archive =
earliest_date = 2015-05-15 04:00:00
earliest_date_markers =
Array
(
    [0] => 
)
latest_date = 2022-10-12 21:00:00
latest_date_markers =
Array
(
    [0] => 
)

WP Timezone
America/New_York
WP GMT Offset
-4
Default PHP Timezone
UTC
WP Date Format
F j, Y
WP Time Format
g:i a
Week Starts On
1
Common Library Dir
/code/wp-content/plugins/event-tickets/common/src/Tribe
Common Library Version
5.0.1
andrewlimaza commented 1 year ago

Thanks for bringing this to our attention @ncmnancy, I was able to replicate this issue. For some reason the "JOIN" logic is missing from The Events Calendar v6+ but works in V5.

Specifically this code isn't running in V6 installations - https://github.com/strangerstudios/pmpro-events/blob/dev/modules/the-events-calendar.php#L29-L34

I am working through documentation on their end to see if anything has changed.

ncmnancy commented 1 year ago

You're welcome! Thanks for digging into it. Please keep me posted.

andrewlimaza commented 1 year ago

I am in talks with one of the developers from The Events Calendar, they say that the latest version may resolve this issue. Please let me know if updating helps.

ncmnancy commented 1 year ago

Thank you for the update!

I've updated The Events Calendar to the latest version. Unfortunately the bug persists.

andrewlimaza commented 1 year ago

@ncmnancy are you still facing this issue? I handed this off to The Events Calendar team to resolve.

andrewlimaza commented 10 months ago

Updating this, while the JOIN and SQL queries are working there are still issues when AJAX is involved in loading the calendar view (monthly event view etc).

We are working with Tribe / The Events Calendar to get to the bottom of this.

andrewlimaza commented 9 months ago

It looks like this issue has been resolved. I am going to close this issue, if you are still experiencing the issue please let us know.