Posted: April 11, 2019 at 1:24 am
|
When moving an attendee to another event/ticket via the attendee mover addon, the first of the four steps is to select an event. Many of our events have the same title, e.g. “Soccer”, but distinguish themselves only from additional meta data we added, e.g. location. When searching for soccer in the first step of the attendee mover the result will be a list of events all with the same title, soccer. Since the list is an ajax call to the generall debug actions and filters does not work. I have looked into the script of the attendee mover addon and found the EE_Attendee_Mover_Event_Select2 which is probably responsible for the list generation. However, I could not find which function it calls in the “backend”. I investigated furhter and came to the “EE_Select_Ajax_Model_Rest_Input” Class which probably handles all ajax calls for the EE4 REST API. Unfortunately, I could not find a way to intercept/alter the way the ajax data for that particular case can be hooked into/altered? Any clues/tips? |
Hi ARAGATO, This isn’t actually a case of hooking into the ‘backend’ to change this, the backend is the REST API and then the data is formatted through JavaScript. There’s an example Josh created for modifying the output shown there here: https://gist.github.com/joshfeck/1e1b43a47a6034b768d6ba125dd53fdf It doesn’t pull additional information from the REST API (which you will need to do for your request) but gives you an idea of how to change the output and give you a base to work from. |
|
|
So, with Josh’s example I pretty much overwrite the attendee-mover-event-selector.js which is provided by the plugin. But I still do not get how I can add additonal data to the data variable (which is filled by the EE4 REST API?). I see the parameters being set. But I do not see/know how to fill the response, the data variabel in in particular. Tehre is the EVT_name in the data variable. How do I catch that AJAX request in the backend and add like “ATT_email” to the data response? |
From the event? You don’t. I’m not sure why you would try to pull ATT_email on the event selection request? Apart from that, again, you don’t hook into the REST API to add additional details, the js file is used to send a request to the an endpoint and then the response is returned, you can then pull whatever data you want from that response within the JS file. In this screenshot – https://imgur.com/p6vs2cY You highlight where the parameters for the REST API are passed, but again, your on the event selection step meaning the request is sent to the event enpoint and will not have anything to do with the attendee, meaning ATT_email isn’t relevant here. Unless I’m misunderstanding what you are trying to do? |
|
|
The “ATT_email” was just an example for a some random meta data. To be more specific. For each event, there is additional metadata written to post_meta (event id = post id), e.g. metadata1, metadata2 I want that metadata1 and metadata2 to be concatenated to the event name in that attendee mover event search box, i.e “Event 1 (metadata1) (metadata2)”.
|
Then you’ll need to be much more specific with those types of examples. ATT_email is not ‘some random meta data’ within Event Espresso, ATT_email is specific to an EE_Contact and nothing to do with an event. The section you are working on relates to events, which means
You tell the REST API to include those fields when sending the request. We have documentation on the REST API here: https://github.com/eventespresso/event-espresso-core/tree/master/docs/C–REST-API And specifically for adding additional fields/models to the request here: I’d also recommend installing the REST API log plugin so you can what happens to the requests when you change the includes. You can also do that with Chrome Dev Tool and follow the network calls then view the response, buts it’s a little easier to view with the log plugin. |
|
The support post ‘[Attendee Mover] Hook into event selection list’ 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.