Support

Home Forums Event Espresso Premium Change My Events query

Change My Events query

Posted: August 20, 2019 at 8:36 pm

Viewing 1 reply thread


Danny B

August 20, 2019 at 8:36 pm

Hello, can this shortcode [ESPRESSO_MY_EVENTS] return all events attached to a particular email instead of by first/last name which I believe it currently is? If not can you point me to the code where this query is running so I can make my own? Thanks


Tony

  • Support Staff

August 21, 2019 at 4:20 am

Hi there,

It’s not searching based on First/Last name, it’s pulling the registrations linked to the current users EE_Contact (meaning it’s using the ATT_ID of the contact).

The EE_Contact is created create when a user registers onto an event, it uses the First Name, Last Name and Email address to create a contact on first registration. Then any additional registrations made in EE which match those exact details will also be linked to the contact.

So the my events add-on is pulling all registrations linked to the EE_Contact that is linked with the current user. If the user has made registrations using different attendee details (and you don’t have the WP User sync feature enabled) those additional registrations will be linked to their own EE_Contact (although that is likely not also linked to a WP user).

There’s a filter you can use to alter the query used by the add-on:

FHEE__Espresso_My_Events__getTemplateObjects__query_args

I have an example of using that filter to alter the query so expired events are filtered out here:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/tw_ee_filter_getTemplateObjects__query_args.php

The system uses a our models to pull the information so you’ll need to understand how those work to use this:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

For the default template (event_section), $template_args['object_type'] will equal ‘Event’, meaning the model you run the queries on will be EEM_Event

For the simple_list_table template, $template_args['object_type'] will equal ‘Registration’ so your running quires on EEM_Registration and need to alter the query args accordingly.

Viewing 1 reply thread

The support post ‘Change My Events query’ 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