Support

Home Forums Event Espresso Premium Minimum Attendees

Minimum Attendees

Posted: April 23, 2018 at 4:56 pm

Viewing 6 reply threads


socialsparkmedia

April 23, 2018 at 4:56 pm

I found two questions about this, but they were from 2015, so I thought I’d check again…

If my event doesn’t get at least 2 registrations, I’d like for it to be cancelled. Additionally, I’d like to then offer a private session if only 1 person registers.

Is there any way to require a minimum number of registrations for an event to be held?

Thanks,
Fran


Josh

  • Support Staff

April 23, 2018 at 5:04 pm

Hi Fran,

Currently Event Espresso does not have a feature that automates or enforces a minimum attendee limit. What some folks have done is set the Default Registration Status setting to “Not Approved”, then once there are a minimum number of sign ups, they switch the event’s Default Registration Status to “Pending Payment”. They also switch the registrations to “Pending Payment” status, which allows for payment to secure the tickets.


socialsparkmedia

April 24, 2018 at 9:30 am

Thanks, Josh. Is there any way to automate notifications that certain classes haven’t met the minimum? My client is not very tech savvy, is there a way to list the classes and their registrations on a private page so he can easily see the status of all upcoming classes?

I appreciate your help.


Josh

  • Support Staff

April 24, 2018 at 3:10 pm

The only way to automate notifications that certain classes haven’t met the minimum would be to build a custom plugin with that specific functionality.

Rather than building a private page that lists out upcoming classes and the number of registrations, you could instead use the regular event list and just display the registration count for the logged in site admin.

So for example you could add this code to a site specific plugin:

add_action( 
    'AHEE_event_details_after_the_content', 
    'ee_display_registration_count', 
    10, 
    2 
);
function ee_display_registration_count( $post ) {
  if(!current_user_can('ee_edit_events')){
    return; // get out!
  }
  $event = $post->EE_Event;
  if ( $event instanceof EE_Event ) {
    if ( ! $event->is_sold_out() && $event->is_upcoming() ) {
      //get total approved registrations count
      $spots_taken = EEM_Registration::instance()->count(array(
        array(
          'EVT_ID' => $post->ID,
          //'STS_ID' => EEM_Registration::status_id_approved,
        ),
      ), 'REG_ID', true);
      // output some html
      $style = 'background-color:#efefef;';
      $style .= 'text-align:center;';
      $style .= 'padding:2em; margin:1em;';
      $style .= 'font-weight:bold;';
      $html = '<div style="'.$style.'" class="registrations">';
      $html .= 'Number of registrations: ';
      $html .= $spots_taken . '</div>';
      echo $html;
    }
  }
}

and that will display the registration count if they’re logged into the site and have the capability to edit Event Espresso events.


socialsparkmedia

April 24, 2018 at 4:43 pm

Hey Josh,
Thanks, but that code doesn’t work for me. Each class is scheduled once a month for the rest of the year, so when it tells me the number of registrations it’s for the entire year, not just for the class in June, for example. Here’s the page so you can see what I mean: https://www.paulcalvoschool.net/events-list-page/

Is there a way to make it show the registrations for each date?

Thanks,
Fran


Josh

  • Support Staff

April 25, 2018 at 8:43 am

Hi Fran,

Yes, you can do this instead:

add_filter(
    'FHEE__espresso_list_of_event_dates__datetime_html', 
    'ee_display_datetime_registration_counts', 
    20, 
    2
);

function ee_display_datetime_registration_counts($html, $datetime){
    if(!current_user_can('ee_edit_events')){
        return $html; // get out!
    }
    $count_regs_for_this_datetime = EEM_Registration::instance()->count(
        array(
            array(
                'REG_deleted'              => 0,
                'Ticket.Datetime.DTT_ID'   => $datetime->ID(),
            ),
           'default_where_conditions' => 'this_model_only'
        )
    );
    $style = 'background-color:#efefef; text-align:center;';
    $style .= 'padding:1em 0; margin:1em 1em 1em 0;';
    $style .= 'font-weight:bold;';    
    $html .= '<div style="'.$style.'" class="ee-reg-count">Number of Regisistrations: ';
    $html .= $count_regs_for_this_datetime . '</div>';
    return $html;
}


socialsparkmedia

April 30, 2018 at 4:18 pm

Thank you, Josh, that worked great! Exactly what I needed.

Viewing 6 reply threads

The support post ‘Minimum Attendees’ 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