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.

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

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  Josh 1 month, 1 week ago ago

Topic Tags

Tagged: 

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!