Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Forked from joshfeck/details_waiting_list.md
Last active May 8, 2017 09:32
Show Gist options
  • Save Pebblo/6d516f012d13c912010a5bb013c1a558 to your computer and use it in GitHub Desktop.
Save Pebblo/6d516f012d13c912010a5bb013c1a558 to your computer and use it in GitHub Desktop.
Add a ninja form to a Sold out Event Espresso 4 event. This is useful if you want to capture names and contact info from people that want to be signed up for a waiting list.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// Display a contact form when the event is sold out
// to be used as a waiting list
function ee_espresso_clean_event_status( $event ) {
//$event = EEH_Event_View::get_event( $EVT_ID );
$status = $event instanceof EE_Event ? $event->get_active_status() : 'inactive';
return $status;
}
function ee_special_sold_out_message( $EVT_ID, $event ) {
//Set the ID of the Ninja Form you wish to call here.
$ninja_forms_id = 6;
//Check if the event is sold out.
if ( ee_espresso_clean_event_status( $event ) == 'DTS' ) {
if( method_exists( 'Ninja_Forms', 'display') ) {
//Using Ninja Forms v3+
Ninja_Forms()->display( $ninja_forms_id );
} elseif( function_exists( 'ninja_forms_display_form' ) ) {
//Using a previous version of Ninja Forms
ninja_forms_display_form( $ninja_forms_id );
}
}
}
add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', 'ee_special_sold_out_message', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment