Support

Home Forums Event Espresso Premium is_active and status

is_active and status

Posted: June 10, 2014 at 5:36 am


Jamie Grisdale

June 10, 2014 at 5:36 am

I was attempting to use EE_Event->is_active() or EE_Event->status but the first returns false and the second returns “not active” even when the event status is upcoming.

EE4 latest, WP latest.


Jamie Grisdale

June 11, 2014 at 2:58 am

In addition, an event has the same status ‘upcoming’ whether tickets are on sale or not so perhaps status is not what I need. How can I determine if tickets are on sale? In this case if the tickets are not on sale then I don’t want a link to the event’s page but rather a coming soon notice on the events index/listing.


Josh

  • Support Staff

June 11, 2014 at 1:39 pm

Hi Jamie,

Can you post the code that you’re trying in a gist so we have a better idea of what to look for? Thanks.


Sidney Harrell

June 11, 2014 at 1:47 pm

You would need to drill down from the event to the datetimes to the tickets:

$events = get_posts(array("post_type"=>'espresso_events'));
							//var_dump($events);
							foreach ($events as $event) {
								if ( !empty( $event->EE_Event ) ) {
									$datetimes = $event->EE_Event->datetimes_ordered();
									//var_dump($datetimes);
									foreach($datetimes as $datetime) {
										$tickets = $datetime->tickets();
										foreach($tickets as $ticket) {
											$is_on_sale = $ticket->is_on_sale();
											var_dump($is_on_sale);
										}
									}
								}
							}


Jamie Grisdale

June 12, 2014 at 1:18 am

Perfect thanks Sidney. (Your link to the code docs in my other post fully answers this too.)

The support post ‘is_active and status’ 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