How can we help?
Attendee limit on registration addon
The tutorial guides you on how you can limit the number of registrations in the Registration addon.
Here are the steps you need to take:
1. There are two ways in which you can do this:
Firstly, you can add a new field called “Registration Limit” from the Field Editor in your backend.
b. You can add a new field in functions.php by following this tutorial: “Event submission form Documentation.”
After that, you can add the code mentioned below.
2. You can go to your functions file by following the given path:
yourprojectname\wp-content\themes\event-listing\functions.php
3. Create a Function
add_filter('event_manager_registration_addon_form','custom_event_registration_form_addon',100);
4. Add the code:
/** * @return boolean */ function custom_event_registration_form_addon(){ $event_id = get_the_ID(); $args = apply_filters( 'event_manager_custom_event_registrations_args', array('post_type' => 'event_registration', 'post_status' => array_diff( array_merge( array_keys( get_event_registration_statuses() ), array( 'publish' ) ), array( 'archived' ) ),'ignore_sticky_posts' => 1,'posts_per_page' => '-1','post_parent' => $event_id ) ); $the_query = new WP_Query( $args ); //change the 5 to your limitation of attendee $registration_limit = get_post_meta($event_id,'_registration_limit',true); //_registration_limit is a field name if($registration_limit >= 0 && $the_query->found_posts >= $registration_limit ){ //if you want to show notice then you can keep below line otherwise remove. echo '<div class="wpem-alert wpem-alert-warning">The registration for this event is full.</div>'; return false; } return true; }