Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created October 5, 2021 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/90a6db6f500bd5af3240ba108fb61144 to your computer and use it in GitHub Desktop.
Save Pebblo/90a6db6f500bd5af3240ba108fb61144 to your computer and use it in GitHub Desktop.
Example of how you can filter registrations based on promotions.
<?php // Do not include the opening PHP tag if you already have one.
add_filter(
'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query',
'tw_ee_filter_registrations_based_on_promo',
10,
2
);
function tw_ee_filter_registrations_based_on_promo( $where, $request_params )
{
//Check we have a Promotion ID set on the request.
if( !empty( $request_params['PRO_ID'] ) ) {
//Add where conditions to limit registrations based on the Promotion ID passed.
$where['Transaction.Line_Item.OBJ_type'] = 'Promotion';
$where['Transaction.Line_Item.OBJ_ID'] = (int) $request_params['PRO_ID'];
}
return $where;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment