Support

Home Forums Event Espresso Premium [ESPRESSO_EVENTS] shortcode in Event Espresso 4 Core Regular v5.0.19.p

[ESPRESSO_EVENTS] shortcode in Event Espresso 4 Core Regular v5.0.19.p

Posted: March 25, 2024 at 4:24 pm

Viewing 4 reply threads


ams4cme

March 25, 2024 at 4:24 pm

When I upgrade to the current EE Core (Event Espresso 4 Core Regular v5.0.19.p), my [ESPRESSO_EVENTS] shortcode stops working. When I enable WP_DEBUG, I see the following error on any page that contains the [ESPRESSO_EVENTS] shortcode. I check and the table “amsdb_esp_datetime” does exist, but there’s also a table “amsdb_esp_tickets”. I was able to get the [ESPRESSO_EVENTS] shortcode working again on my site by downgrading to EE Core 5.0.17.

— ERROR —
WordPress database error: [Not unique table/alias: ‘amsdb_esp_datetime’]

SELECT SQL_CALC_FOUND_ROWS amsdb_posts.*, amsdb_esp_datetime.* , MIN( amsdb_esp_datetime.DTT_EVT_start ) as event_start_date
FROM amsdb_posts INNER JOIN amsdb_esp_datetime ON ( amsdb_posts.ID = amsdb_esp_datetime.EVT_ID ) INNER JOIN amsdb_esp_datetime ON ( amsdb_posts.ID = amsdb_esp_datetime.EVT_ID ) INNER JOIN amsdb_esp_datetime_ticket AS Datetime_Ticket ON ( Datetime_Ticket.DTT_ID=amsdb_esp_datetime.DTT_ID ) INNER JOIN amsdb_esp_ticket AS Ticket ON ( Datetime_Ticket.TKT_ID=Ticket.TKT_ID )
WHERE 1=1 AND ((amsdb_posts.post_type = ‘espresso_events’ AND (amsdb_posts.post_status = ‘publish’ OR amsdb_posts.post_status = ‘cancelled’ OR amsdb_posts.post_status = ‘postponed’ OR amsdb_posts.post_status = ‘sold_out’ OR amsdb_posts.post_status = ‘acf-disabled’ OR amsdb_posts.post_status = ‘wc-tec’
OR amsdb_posts.post_status = ‘private’))) AND amsdb_esp_datetime.DTT_EVT_end > ‘2024-03-25 19:53:55’ AND amsdb_esp_datetime.DTT_deleted = 0 AND Ticket.TKT_end_date > “2024-03-25 19:53:55” AND Ticket.TKT_deleted=0 GROUP BY amsdb_posts.ID ORDER BY event_start_date ASC LIMIT 0, 10

/* From [www.americanmedicalseminars.com/rob-testing/] in [/nas/content/live/ams4cme/wp-content/plugins/event-espresso-core-reg/core/domain/services/wp_queries/EventListQuery.php:77] */


Rio

  • Support Staff

March 25, 2024 at 7:00 pm

I did try to use [ESPRESSO_EVENTS] in my 5.0.19 but i did not receive any problem. Do you have stagging site? can you try to check if there’s a plugin conflict that is going on? Did you also customized your shortcode or add some code snippet in your child theme or create plugin that is related to EE?

Where did you see the error? can you send screenshot of its location?

thanks


ams4cme

March 28, 2024 at 3:33 pm

Hmm. I was able to get it working by removing the following filters from my functions.php file. Both sets of code came from EE Support Forums. Are either still necessary in newer versions of EE?

THE CODE I REMOVED:

/**
* The purpose of this snippet is to filter the event archive (and event taxonomy archive) pages so that they exclude events
* that have tickets no longer on sale.
*
* NOTE: This query is only valid for Event Espresso 4.8+
*
* To Implement this code, add it to the bottom of your themes functions.php file, or add it to a site specific plugin.
*
*/
function de_ee_tweak_event_list_exclude_ticket_expired_events_where( $SQL, WP_Query $wp_query ) {
if ( isset( $wp_query->query_vars[‘post_type’] ) && ( $wp_query->query_vars[‘post_type’] == ‘espresso_events’ || ( is_array( $wp_query->query_vars[‘post_type’] ) && in_array( ‘espresso_events’, $wp_query->query_vars[‘post_type’] ) ) ) && ! $wp_query->is_singular ) {
$SQL .= ‘ AND Ticket.TKT_end_date > “‘ . current_time( ‘mysql’, true ) . ‘” AND Ticket.TKT_deleted=0’;
}
return $SQL;
}
add_filter( ‘posts_where’, ‘de_ee_tweak_event_list_exclude_ticket_expired_events_where’, 15, 2 );

function de_ee_tweak_event_list_exclude_ticket_expired_events_join( $SQL, $wp_query ) {
if ( isset( $wp_query->query_vars[‘post_type’] ) && ( $wp_query->query_vars[‘post_type’] == ‘espresso_events’ || ( is_array( $wp_query->query_vars[‘post_type’] ) && in_array( ‘espresso_events’, $wp_query->query_vars[‘post_type’] ) ) ) && ! $wp_query->is_singular ) {
if ( ! $wp_query->is_espresso_event_archive && ! $wp_query->is_espresso_event_taxonomy ) {
$SQL .= ‘ INNER JOIN ‘ . EEM_Datetime::instance()->table() . ‘ ON ( ‘ . EEM_Event::instance()->table() . ‘.ID = ‘ . EEM_Datetime::instance()->table() . ‘.’ . EEM_Event::instance()->primary_key_name() . ‘ ) ‘;
}
$SQL .= ‘ INNER JOIN ‘ . EEM_Datetime_Ticket::instance()->table() . ‘ AS Datetime_Ticket ON ( Datetime_Ticket.DTT_ID=’ . EEM_Datetime::instance()->table() . ‘.’ . EEM_Datetime::instance()->primary_key_name() . ‘ ) INNER JOIN ‘ . EEM_Ticket::instance()->table() . ‘ AS Ticket ON ( Datetime_Ticket.TKT_ID=Ticket.’ . EEM_Ticket::instance()->primary_key_name() . ‘ ) ‘;
}
return $SQL;
}
add_filter( ‘posts_join’, ‘de_ee_tweak_event_list_exclude_ticket_expired_events_join’, 3, 2 );


Rio

  • Support Staff

March 28, 2024 at 6:17 pm

ooh yes, We have that Snippet reported. Our Developers made adjustment and it is under testing. Once it pass the test it will be available in the upcoming update.

Thanks


dee4dogs

April 2, 2024 at 8:14 pm

Following this one, as I think we have the same issue.


Rio

  • Support Staff

April 2, 2024 at 11:55 pm

We may have solution for that.

https://eventespresso.com/topic/do-you-guys-know-of-any-issues-with-shortcodes-elementor/?view=all#post-353690

you need to have the updated version of the snippets above to fix the issue for now but it may also need to be updated again once we ‘fix’ core.

The issue is with the code after this line:

add_filter(‘pre_get_posts’,’searchfilter’);

Replace that code with this:

https://gist.github.com/Pebblo/f6999040cf2df3965c1b75ac99f9c20b

But again, this may need to be updated.

If you can wait till the next version update, this issue will be resolved.

thanks

Viewing 4 reply threads

The support post ‘[ESPRESSO_EVENTS] shortcode in Event Espresso 4 Core Regular v5.0.19.p’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso