Skip to content

Instantly share code, notes, and snippets.



Created Aug 31, 2018
What would you like to do?
Adds an additional filter to the Event Espresso -> Registrations list table allows you to also filter the transaction status.
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter('FHEE__Extend_EE_Registrations_List_Table__filters', 'tw_ee_add_txn_status_filter_to_reg_list_table', 10, 3);
function tw_ee_add_txn_status_filter_to_reg_list_table( $filters, $list_table_object, $screen ) {
global $wpdb;
$txn_statuses = array();
//Pull the current transaction statuses from the DB
$results = $wpdb->get_results(
"SELECT STS_ID, STS_code FROM {$wpdb->prefix}esp_status WHERE STS_type = 'transaction'"
//Loop over the available statuses and build and array using STS_ID => STS_code
foreach ($results as $status) {
$txn_statuses[ $status->STS_ID ] = $status->STS_code;
//Localize the transaction statuses.
$txn_statuses = EEM_Status::instance()->localized_status($txn_statuses, false, 'sentence');
//Build out the txn status select options, setting 'Select TXN Status' as the first option.
$txn_statuses_select[] = array('id' => 0, 'text' => __('Select TXN Status', 'event_espresso'));
foreach ($txn_statuses as $key => $value) {
$txn_statuses_select[] = array('id' => $key, 'text' => $value);
//Add the TXN status select input to the filters, if a TXN status is set on the request, select it.
$filters[] = EEH_Form_Fields::select_input(
!empty(EE_Registry::instance()->REQ->get('_txn_status')) ? strtoupper(sanitize_key(EE_Registry::instance()->REQ->get('_txn_status'))) : ''
return $filters;
add_filter('FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query', 'tw_ee_reg_list_table_txn_status_where', 10, 2);
function tw_ee_reg_list_table_txn_status_where( $where, $request ) {
//Check we have a TXN status on the request.
if( !empty( $request['_txn_status'] ) ) {
//Add the transaction status to the where conditions.
$where['Transaction.STS_ID'] = array('=', sanitize_key($request['_txn_status']));
return $where;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.