Support

Home Forums Event Espresso Premium Event status filter combo to view active & upcoming events at once in admin

Event status filter combo to view active & upcoming events at once in admin

Posted: April 13, 2020 at 2:32 pm


tyler

April 13, 2020 at 2:32 pm

Filters for event statuses in the backend are: Active or Upcoming or Expired or Inactive

Can you create filter for both Active/Upcoming?

Our client would like to be able to view events in both statuses at once.


Josh

  • Support Staff

April 13, 2020 at 6:33 pm

Hi,

You can add the following code to your site to change the default view:

add_filter( 
  'FHEE__Events_Admin_Page__get_events__query_params', 
  'jf_ee_change_event_list_default_query_params', 
  10, 
  2 
);
function jf_ee_change_event_list_default_query_params( 
    array $params, $req_data 
) {
  if ( ! array_key_exists( 'active_status', $req_data ) ) {
    $params[0]['Datetime.DTT_EVT_end'] = array( 
        '>',
        current_time( 'mysql', true ) 
    );
    $params['order_by'] = 'Datetime.DTT_EVT_start';
    $params['order'] = 'asc';
  }
  return $params;
}

You can add the above to a functions plugin or, if available, into your WordPress child theme’s functions.php file.

This doesn’t add a new filter option, but instead the default events view will be Active and Upcoming events.

The support post ‘Event status filter combo to view active & upcoming events at once in admin’ 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