Support

Home Forums Event Espresso Premium EE3 Upcoming Events Widget Sold Out Events

EE3 Upcoming Events Widget Sold Out Events

Posted: July 24, 2014 at 12:44 am


Michael Cunningham

July 24, 2014 at 12:44 am

Version 3.1.36.4.P

Hello,

I am trying to customize the Upcoming Events Widget template.

In the template there is:
echo $status_display; //Turn this on to display the overall status of the event.

This is close to what I want. When I add this to my template it correctly says “Open”. But when the max number of attendees is reached for the event, it does not change the status. Is there a way I can tie into custom messages to display “Sold Out” for events that have reached max attendance?


Tony

  • Support Staff

July 24, 2014 at 4:51 am

Hi Michael,

You would need to compare the reg_limit for the event, with the attendee registered onto that event and see if there are spaces available.

Luckily we have a function that will do that for you, here is a quick example to simply echo back “Sold out” when the event reg limit is reached.

You’ll need to add the function to get the number of available spaces within the event, add this within the foreach loop for the events, around line 116:

$number_available_spaces = get_number_of_attendees_reg_limit($event->id, 'number_available_spaces');

Then add a conditional to the output of the li:

You could do much more and add extra styling to this but the basic idea is the same. I added that to the widget.php template on line 132 but within the Span and a tag but again you could do this differently- http://take.ms/QWJ5n

Does that help?


Michael Cunningham

July 24, 2014 at 12:50 pm

Yes, that is exactly what I was looking for. Thank You!

The support post ‘EE3 Upcoming Events Widget Sold Out Events’ 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