Home Forums Event Espresso Premium Filter the Admin Transactions listing by category

Filter the Admin Transactions listing by category

Posted: February 8, 2024 at 9:22 pm

February 8, 2024 at 9:22 pm

I have created functions to filter the Event Listings & Registration Listings in admin by category. Is this possible for transactions?

I have found the filter FHEE__Transactions_Admin_Page___get_transactions_query_params which I assume I would use. But I’m not sure what to edit in the $where variable? In Events I used:

$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
$where['Term_Taxonomy.term_id'] = $term->term_id;

and for Registrations I used

$where['Event.Term_Taxonomy.term_id'] = $term->term_id;



  • Support Staff

February 9, 2024 at 7:49 am

Hi there,

The dot notation can be thought of has it relates….

So to answer your question you use:



$where['Registration.Event.Term_Taxonomy.term_id'] = $term->term_id;

Because you’re setting the condition for the term relating to the event relating the registration relating to this transaction.

Using the model system to query is a little confusing at first, but it gets easier as you work with it. If you haven’t done so already take a look over the docs here:–Model-System

February 19, 2024 at 6:49 pm

Thanks Tony. I still struggle with the model system, so is it possible to do something like:

        // Add the term ID to the where clause to filter the events
        $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
        $where['Term_Taxonomy.term_id'] = $term->term_id;
        // Add condition to include events authored by the current user
        $where['Event_CPT.EVT_wp_user'] = $current_user->ID;

I know the Model notation for the author is wrong, but if that was correct, it would only show events with the relevant term by the current user. What I am after is events with the relevant term and events by the current user.

In terms of the filter, I am after ‘OR’ rather than ‘AND’. Hopefully that makes sense. How would I achieve this?


  • Support Staff

February 20, 2024 at 4:29 am

Sure it is, the models are really powerful, you can do some pretty complex queries relatively easily.

For your request, you need to view:–Model-System/

The code, would just be:

$where_params = [
    'OR' => [
        'Registration.Event.EVT_wp_user' => get_current_user_id(),
	'Registration.Event.Term_Taxonomy.term_id' => $term->term_id,

Which output this where:

WHERE ( (Registration.REG_deleted = 0) OR Registration.REG_ID IS NULL) AND ( (Registration___Event_CPT.post_type = 'espresso_events' AND Registration___Event_CPT.post_status NOT IN ('auto-draft','trash')) OR Registration___Event_CPT.ID IS NULL) AND (Registration___Event_CPT.post_author = 123 OR Registration__Event___Term_Taxonomy.term_id = 999)

I think that’s what you are looking for, right?

February 20, 2024 at 9:33 pm

Thanks Tony. I was after either events with the term id, or events created by the current user. With your example and the links you provided my code now works – so posting here in case it helps someone else:

// Check if the term exists
if ($term && !is_wp_error($term)) {
   $where['OR*events_by_user_or_term'] = array('EVT_wp_user' => $current_user->ID,'Term_Taxonomy.term_id' => $term->term_id);
} else {
    // If no term is found, just filter by the event creator
    $where['EVT_wp_user'] = $current_user->ID;


  • Support Staff

February 21, 2024 at 3:00 am

Awesome, glad it helped 🙂

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

Event Espresso