Support

Home Forums Event Espresso Premium Different waitlist ninja forms for different events

Different waitlist ninja forms for different events

Posted: November 4, 2017 at 3:39 am

Viewing 12 reply threads


AlphaStar

November 4, 2017 at 3:39 am

Hello,

We were using the same form for collecting waitlist subscriptions for sold out events. But we decided to handle it in a different way. We created a waitlist on MailChimp and groups in that list with the events. We want to allow our customers to subscribe to the corresponding group in that email list. Ninja Forms MailChimp add on allows us to do this.

How can I associate different events to different ninja forms? Currently the code we are using is:

/*
* Display a contact form when the event is sold out to be used as a waiting list
*/
function ee_espresso_clean_event_status( $event ) {
$status = $event instanceof EE_Event ? $event->get_active_status() : 'inactive';
return $status;
}

function ee_special_sold_out_message( $post ) {
$EVT_ID = $post->ID;
$event = EEH_Event_View::get_event( $EVT_ID );
if ( $event instanceof EE_Event ) {
//Check if the event is sold out.
if ( ee_espresso_clean_event_status( $event ) == 'DTS' || $event->display_ticket_selector() == 0 ) {
//Set the ID of the Ninja Form you wish to call here.
$ninja_forms_id = 2;
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_event_details_after_venue_details', 'ee_special_sold_out_message', 10 );

Thanks.


Tony

  • Support Staff

November 6, 2017 at 2:56 am

Hi there,

You could set a meta field on the event – http://take.ms/FdDM2

Then check that field before passing an ID to ninja forms, so change this:

$ninja_forms_id = 2;

to this:

if($event->get_post_meta( 'ninja_waitlist_id', true )) {
    $ninja_forms_id = $event->get_post_meta( 'ninja_waitlist_id', true );
} else {
    $ninja_forms_id = 2;
}

‘ninja_waitlist_id’ can be whatever you want but the key you use in the event, must match whatever you use in the function.


AlphaStar

November 9, 2017 at 1:03 am

Worked like a charm, thanks a lot!


Tony

  • Support Staff

November 9, 2017 at 1:41 am

You’re most welcome.


AlphaStar

November 12, 2017 at 1:01 am

Hello again.

Which hook should I use to show the form above the instructors section? Basically right after the page title?

Thanks.


Tony

  • Support Staff

November 13, 2017 at 4:22 am

I don’t think we have a hook for that location, you could use the_content hook, check for the espresso_events post type and add it in using that.

The locations of elements on the page is customizable to the ‘instructors section’ could be anywhere, you mentioned just after the event title which is where I checked, but can you link me to an event I can view so I can confirm.


AlphaStar

November 13, 2017 at 6:22 pm

Thanks, you reminded me I could move the instructor block down and that solved the problem.

Another question. How can I assign a class (to make it outstand) to the form fields?

As an example: https://alphastar.academy/events/test/ event could use the CSS class message-red for the form.

Thanks in advance.


Tony

  • Support Staff

November 14, 2017 at 1:46 am

Which specific fields are you referring to? The ninja form fields?


AlphaStar

November 14, 2017 at 2:16 am

Yes, the whole container as in:

https://imagebin.ca/v/3hFTDOJlTtgG

Thanks…


Tony

  • Support Staff

November 14, 2017 at 2:22 am

As your trying to edit Ninja forms, that would be a great question to ask their support, however, I think you can add custom classes to a form within:

Ninja Forms -> {edit form} -> Advanced -> Display settings -> Advanced -> CUSTOM CLASS NAMES


AlphaStar

November 14, 2017 at 2:25 am

Thanks a lot again Tony. I appreciate your help.


Tony

  • Support Staff

November 14, 2017 at 2:32 am

You’re most welcome 🙂


Garth

  • Support Staff

July 25, 2018 at 12:48 pm

I know you’re using Ninja Forms, but I wanted to let you know that the official Event Espresso 4 wait list add-on is now available: https://eventespresso.com/2018/07/wait-list-manager-event-espresso-4/

Viewing 12 reply threads

The support post ‘Different waitlist ninja forms for different events’ 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