Support

Home Forums Event Espresso Premium Cannot edit Venue on existing events.

Cannot edit Venue on existing events.

Posted: December 23, 2024 at 9:56 am

Viewing 4 reply threads


PPATEC

December 23, 2024 at 9:56 am

We are having an almost identical issue to this – https://eventespresso.com/topic/error-updating-event-when-adding-a-venue/

It’s hard for me to say since some of the messages in the thread are private. But we are able to create an event using our template “Class/Events Pages Page Template (single-espresso_events.php)” but we cannot edit the venue for any already created Events.


Tony

  • Support Staff

December 30, 2024 at 6:13 am

Hi there,

Apologies for the delay from the holidays.

We’ll need to dig into this a little to find out what is happening.

I assume your setting the venue on the event itself and not the datetime?

https://monosnap.com/file/xMEpVwL87E2a9yff83ShCN8Er3oWPt

When doing this, if you open up Dev Tools within your browser and sit on the Network tab, you’ll see a ‘graphql’ request:

https://monosnap.com/file/0EwGYhJ6qk1n3wOM89CEgU16zdkNeM

Can you post the response tab from that here?


PPATEC

December 31, 2024 at 12:54 pm

Hey Tony, no problem at all!

To your first question, yes we are just trying to change the Venue for an existing event. So the Venue is already set, and when we try to change the venue we get the error.

To your second question, please see below:
Just a note, we have been using this same template since we started using the plugin, but the error is fairly new.

[
{
“errors”: [
{
“message”: “Invalid page template.”,
“extensions”: {
“category”: “user”
},
“locations”: [
{
“line”: 2,
“column”: 3
}
],
“path”: [
“updateEspressoEvent”
]
}
],
“data”: {
“updateEspressoEvent”: null
},
“extensions”: {
“debug”: [
{
“type”: “DEBUG_LOGS_INACTIVE”,
“message”: “GraphQL Debug logging is not active. To see debug logs, GRAPHQL_DEBUG must be enabled.”
}
]
}
}
]


Tony

  • Support Staff

January 2, 2025 at 6:56 am

Yeah, that’s odd!

So, the error “Invalid page template.” is from WordPress itself, within \wp-includes\post.php

This code: https://github.com/WordPress/WordPress/blob/5247f68e15f0f19dae77b9b860882d782adfc5a9/wp-includes/post.php#L4937-L4950

So the page template is set, but not considered valid.

I’ve managed to reproduce this locally and it’s caused by wp_get_theme()->get_page_templates( $post ); returning no page_templates becuase it’s using the post_type from $post being passed to it (which is espresso_events) and your template isn’t specifically for that post type (which is correct, its a post template and that’s expected).

Combine that with wpgraphql (which is what we use in the background to update) setting wp_update_post()to return any errors thrown and you get the above (wp_update_post just calls wp_insert_post with some additional params set) . On a standard update, wp_update_post is set not to return errors and just carries on, then something else must be setting the page template separately (I haven’t dug further into that but will), the params passed to both are the same with the exception of wp_error being false and its true within wpgraphql.

So, in short, it’s from having a custom page template set for a custom post type, which WP then doesn’t load when checking for the page template, and wpgraphql sets the update method to return errors.

I tested setting wpgraphql to not return errors but then WP sets the page template to ‘Default’ because it couldn’t find a page template for the post type!

So… I have a workaround which whilst isn’t great, will get your Venue updated.

First, set the page template on the event to default and update the event.

When the page reloads, set the venue to the correct venue, the WPGraphQL request should then work as expected and show the venue updated.

Now set the page template back to whichever template you were using before and update the event as normal.

I’ve created a ticket for our developers to investigate this further and see what we can do to prevent this.


PPATEC

January 3, 2025 at 7:01 am

Thanks Tony!

Viewing 4 reply threads

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso