Support

Home Forums Event Espresso Premium Need to get the upcoming events and exclude all the events from private category

Need to get the upcoming events and exclude all the events from private category

Posted: May 13, 2020 at 2:48 pm

Viewing 1 reply thread


RMK

May 13, 2020 at 2:48 pm

Hi
I need to fetch all the upcoming events from all the categories except 1 named “private” -> ID(574)

here is the code I am using and able to get the upcoming events but unable to filter it from Private category
$events = EEM_Event::instance()->get_all(
array(
‘limit’ => 10,
‘QST_wp_user’ => array(‘in’, array(4)),
‘order_by’ => array( ‘Datetime.DTT_EVT_start’ => ‘ASC’ ),
‘group_by’ => ‘EVT_ID’,
array(
‘Datetime.DTT_EVT_end’ => array( ‘>=’, current_time(‘mysql’) ),
‘status’ => ‘publish’,
)
)
);

Can someone please take a look

Thanks


RMK

May 13, 2020 at 2:49 pm

Hi
I need to fetch all the upcoming events from all the categories except 1 named “private” -> ID(574)

here is the code I am using and able to get the upcoming events but unable to filter it from Private category
$events = EEM_Event::instance()->get_all(
array(
‘limit’ => 10,
‘QST_wp_user’ => array(‘in’, array(4)),
‘order_by’ => array( ‘Datetime.DTT_EVT_start’ => ‘ASC’ ),
‘group_by’ => ‘EVT_ID’,
array(
‘Datetime.DTT_EVT_end’ => array( ‘>=’, current_time(‘mysql’) ),
‘status’ => ‘publish’,
)
)
);

Can someone please take a look

Thanks


Tony

  • Support Staff

May 14, 2020 at 7:45 am

Hi there,

Are you sure that is the correct code you are currently using? It isn’t valid and will throw a fatal error due to this:

'QST_wp_user' => array('in', array(4)),

QST_wp_user is not a valid query param on EEM_Event.

But, to answer your question you would add this to your where conditions:

'Term_Taxonomy.Term.term_id' => array( 'NOT_IN', array(574) )

Viewing 1 reply thread

The support post ‘Need to get the upcoming events and exclude all the events from private category’ 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