eventespresso / eea-rest-api

Event Espresso 4 Rest API
GNU General Public License v2.0
6 stars 2 forks source link

Venue ID in two EE tables... which one? #45

Open dcdigit opened 1 year ago

dcdigit commented 1 year ago

Venue ID in wp_esp_event_venue table, but admin UI seems to be controlled by wp_esp_event_meta.VNU_ID column.

Using the API can POST/PUT the row into the wp_esp_event_venue table but it DOES NOT show in the WP Admin UI.

The Venue is only "linked" if the wp_esp_event_meta.VNU_ID column has data in it.

Please advise.

dcdigit commented 1 year ago

Repro: Put a join row in the wp_esp_event_venue table and load the Admin UI. No Venue is displayed. The UI shows "Select a Venue" rather than the venue corresponding to the one in the join row.

Expected wp_esp_event_venue to control the join.

dcdigit commented 1 year ago

Using API v4.8.36. /wp-json/ee/v4.8.36/event_venues POST data is this json: {'EVT_ID': 54738, 'VNU_ID': 10866}

I can see it in the mysql table after the API POST, but when I load the admin UI, it shows no venue.

dcdigit commented 1 year ago

Oh I see - it may be related to this: ~/repos/ee/wp-content/plugins/event-espresso-core-reg/core/data_migration_scripts/5_0_0_stages/EE_DMS_5_0_0_Event_Venues.dmsstage.php:


    3  /**
    4   *
    5:  * EE_DMS_5_0_0_Event_Venues
    6   * Copies Venue IDs from `wp_esp_event_venue` to `wp_esp_event_meta` for each Event
    7   *
dcdigit commented 1 year ago

I just recently updated to v5

tn3rb commented 1 year ago

wp_esp_event_venue is deprecated so just ignore that.

Relations to Venues are now stored in either:

the above are not mutually exclusive, so you can have a venue specified for the event as well as separate venues specified for individual datetimes (ex: three day conference at a conference center with separate workshops in separate rooms within the conference center).

dcdigit commented 1 year ago

Ok, thank you for the pointer. I don't see any "official" Admin UI editing for datetimes-to-venues. This is a feature I would like to know more about - can you tell me how developed is the support for this in the main EE system? Or, is it just a recommendation for something I could build/extend? TY!

dcdigit commented 1 year ago

Also, I am looking at the API version 4.8.36 and I see this function... is this what I would use to link venue-to-event now?

"/ee/v4.8.36/venues/(?P<id>[^\\/]+)/post_metas/(?P<related_id>[^\\/]+)": { "namespace": "ee/v4.8.36",

dcdigit commented 1 year ago

Uh, sorry - I think there is an emergency... beyond just this API question can you comment on this bug before I go and post it to the support forum?

After updating to v5.... NONE of my venue listings are showing! wp_event_esp_meta.VNU_ID is set to 0 for ALL events. When I go to edit the Event in the Admin UI - the Event is set to "Select an Event" When I go to my single event page that shows event venue info there is NO info.

Help!

dcdigit commented 1 year ago

I thought there was a data migration? At least there seemed to be some evidence of that in the migrations scripts... Please advise.

garthkoyle commented 1 year ago

In EE5, you can assign datetimes to venues.

image

There was a migration for venues in EE5, and there was a bug fixed in 5.0.3: https://eventespresso.com/wiki/ee4-changelog/

dcdigit commented 1 year ago

That looks great - BUT - where is that interface element/UI? Is there a link/path you can send me? Or send a screenshot in context to show me how to navigate to that specific layout? I do not see it anywhere and I have clicked all around.

BTW - I am still in class ic edit mode. Maybe this assumes Block Editor?

garthkoyle commented 1 year ago

That's part of the new event editor. You can enable that in Event Espresso 5+ by going to Event Espresso > Events > Default Settings tab > Advanced Editor

image
tn3rb commented 1 year ago

Venues are assigned to Events and/or Datetimes via the Event Editor. So go to admin.php?page=espresso_events and edit any event. Garth showed how to activate the new advanced editor that allwos you to assign venues to datetimes.

Anyways, it sounds like your v5 migration did not run.

How did you perform the update to EE5? Did you run the data migrations?

Since you obviously seem to know your way around code, if need be, you can write a script that essentially runs the queries in EE_DMS_5_0_0_Event_Venues for each event you have, or in other words:

dcdigit commented 1 year ago

Wow! That venue-to-datetime connection looks like exactly what we need right now! One of my clients literally just asked for this very thing. So, big question for me (and the reason the clients want this) is that it has to have the correct scope and filters so I can use this venue info in an email reminder. I've written many email shortcodes so I am curious to know if this new feature got support in the messaging system yet.

Thanks for any insight.