Support

Home Forums Event Espresso Premium Add new filter in attendees searcher

Add new filter in attendees searcher

Posted: January 31, 2019 at 6:59 am


guiapenin

January 31, 2019 at 6:59 am

I’ve added 2 filters to the attendees searcher in the page ‘espresso_registrations’ and they work perfectly.

This is the code I’ve used to add the filters.


add_filter(
'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query',
'my_custom_search_field_reg',
10,
2
);

function my_custom_search_field_reg( $where, $request ) {
if (isset($request['s'])) {
$search_string = '%' . sanitize_text_field($request['s']) . '%';
$where['OR*search_conditions']['Answer.ANS_value'] = array('LIKE', $search_string);
$where['OR*search_conditions']['Answer.ANS_value'] = array('LIKE', $search_string);
$where['OR*search_conditions']['Attendee.ATT_phone'] = array('LIKE', $search_string); }
return $where;
}

I would like to filter attendees by their promotion codes. I’ve looked in the database and they are in the field ‘LIN_desc’ of the ‘_line_item’ table and in the field ‘PRO_code’ of the ‘_promotion’ table.

Is it possible to add this field to the searcher filters? How could I do it?

Thank you beforehand


Josh

  • Support Staff

January 31, 2019 at 12:29 pm

Hi,

You can add this to your list you have there:

$where['OR*search_conditions']['Transaction.Line_Item.LIN_desc'] = array('LIKE', $search_string);


guiapenin

February 1, 2019 at 1:24 am

Lots of thanks!

The support post ‘Add new filter in attendees searcher’ 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