Support

Home Forums Event Espresso Premium Show Attendee Numbers

Show Attendee Numbers

Posted: September 10, 2014 at 5:27 am


Ben

September 10, 2014 at 5:27 am

EE3 all add ons

Hi Guys,
Hope your all well!

I’m trying to find out if some shortcode is still applicable and whether its in the right location.

http://www.getcookingedmonton.com/cooking-classes/event-registration/?ee=186
http://screencast.com/t/FiZeED3g

Can the shortcode also be applied for the event list? – http://www.getcookingedmonton.com/class-list/

Currently it is only showing ‘0’ attendees if the event is full.

I have gone through this Doc, but I believe this not working correctly – https://eventespresso.com/wiki/how-to-customize-your-available-spaces-text/#
Is this now superseded by this? – http://screencast.com/t/ZQQT3KZkVT

Thanks.


Dean

September 10, 2014 at 6:21 am

Hi Ben,

The shortcodes can be added to any template file via the do_shortcode() function – http://codex.wordpress.org/Function_Reference/do_shortcode

What shortcode are you using exactly? And where?

That document isn’t out of date per se, it has it’s uses. The ATTENDEE_NUMBERS will show numbers. But if you wanted to show a worded respons (e.g. Spaces still available, or running out soon) then that document could be used.

You could also use the ATTENDEE_NUMBERS shortcode in a similar way by not echoing it but adding the result to a variable and comparing that value.


Ben

September 10, 2014 at 7:30 am

Thanks Dean,

I’m using – <p>Available Spaces: [ATTENDEE_NUMBERS event_id=186 type=available_spaces]</p>
here – http://screencast.com/t/FiZeED3g
In the actual event overview for this single event.
How can I get it showing for each of the events without copy and pasting each time, and having to get the right event ID, as someone else will be creating the events?

How can I also get it showing correctly in the event list also with a message. This is the event_list_display.php in the templates folder – http://screencast.com/t/jIwwOsm6
Does that look right what is currently showing?

Thanks


Lorenzo Orlando Caum

  • Support Staff

September 10, 2014 at 9:25 am

Hi,

Please see the template code here:

https://eventespresso.com/wiki/shortcodes-template-variables/#attendee-numbers


Lorenzo


Ben

September 10, 2014 at 9:47 am

Thanks Lorenzo,

I’m aware of that. What I’m asking is where it needs to be placed?

There are 2 different event views as described above. Is there a template for both of them?


Tony

  • Support Staff

September 10, 2014 at 10:42 am

Yes there are two different template files.

Event list uses event_list.php and event_list_display.php.
These are located within event-espresso/templates/

The registration page uses registration_page.php and registration_page_display.php

The files without _display are used to pull in all the information and declared variables for use.

The _display files are used to output the sections using that info/variables.


Ben

September 11, 2014 at 7:27 am

Thanks Tony,

This is the current code –

= $reg_limit) {
		?>
		

This suggestion below is not working as a replacement due to a syntax error -

= $reg_limit) {
        ?>

It appears what we currently have is more substantial code as the standard, but it doesn't seem to be showing as we want it. Would you agree?

  • This reply was modified 9 years, 7 months ago by  Tony. Reason: fixed code formatting


Josh

  • Support Staff

September 11, 2014 at 7:36 am

Hi Ben,

Please explain what you mean by more substantial code? Along with that, it looks like you have an extra closing brace now that you’ve removed the else statement.


Ben

September 11, 2014 at 7:54 am

Thanks Josh,

The first set of code is actual the default code in the event_list_display.php, where as the 2nd customise code seems to be less detailed.

The goal is to have the attendee numbers displayed in each event, as well as the event list.

Thanks.


Tony

  • Support Staff

September 11, 2014 at 8:20 am

The reason the Available spaces is not showing on the event list (the original code) is because you have ‘Display Registration Form’ set to No.

You can see in that code it checks the attendee numbers:

if ($num_attendees >= $reg_limit) {

If $num_attendees is greater than or equal to the reg limit (the event is sold out or oversold) then display no spaces.

Then you have

} else {

so if the $num_attendee is not greater than or equal to (there must be spaces available, do this:

if ($display_reg_form == 'Y' && $externalURL == '') {
	?>

The if checks if 'Display Registration Form' is set to YES, if it is then show the available spaces, otherwise don't.

So you want to remove that from the check...

if ($externalURL == '') {

Which now just checks if the Alt Registration URL is not set to anything.

If you are unsure about the above I would suggest contacting a developer to help.


Ben

September 11, 2014 at 10:18 am

That’s great Josh,

Works great on the Event List, thanks!

Took me a bit of time to look through the registration_page_display, but I’ve got it working in there now also.

Thanks for your help!


Tony

  • Support Staff

September 11, 2014 at 10:26 am

No Problem Ben,

Glad you got it working 🙂

I’ll mark this thread resolved, if you do have any other questions feel free to start another.

Tony

The support post ‘Show Attendee Numbers’ 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