Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active January 12, 2021 23:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joshfeck/fa7725952e9087c1a781 to your computer and use it in GitHub Desktop.
Save joshfeck/fa7725952e9087c1a781 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