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


bee_jeffersonstovall

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


bee_jeffersonstovall

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) )

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  Tony 2 months, 3 weeks ago ago

Topic Tags

Notifications

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