Tracking Series Event Start Date to Disable Gravity Form after start date passed

Home Forums Calendar Products Events Calendar PRO Tracking Series Event Start Date to Disable Gravity Form after start date passed

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1323687
    Linda
    Participant

    Hi there,

    We have a gravity form on event pages. I would like the form not to show if the start date of a series event has passed. Can you give me some direction on possible ways to accomplish this?

    I need to track if event is a series events and then check the event start date. We then want to disable the gravity form if the date is passed the event start date.

    Here’s an event that has passed.
    https://demo.venturiwebdesign.com/event/beginner-swing-level-1-swing-outs-circles-4wk-series-begins-newburgh/

    #1324685
    Barry
    Member

    Hi Linda!

    Sounds like you’re building some cool stuff 🙂

    While we can’t go into too much depth with custom dev questions like this one I can certainly try to point you in the right direction.

    On our side, it’s possible to use helper functions such as tribe_get_end_date() to find out when an event is scheduled to end. You can use this in a comparison with the current time, something like:

    $current_post = get_the_ID();
    
    if ( tribe_get_end_date( $current_post, false, 'U' ) > current_time( 'timestamp' ) ) {
        // The event has not ended!
        // Display a form
    }

    That of course is just a stub, but if you combine this with some Gravity Forms know-how (perhaps their team can help out on that angle, by pointing you to a suitable hook or action that lets you enable or disable specific forms) you might be able to get closer to your end goal.

    Good luck!

    #1324826
    Linda
    Participant

    Hello There,
    Thanks for your response. Unfortunately, I don’t need Event End date. I need functions for two separate things:
    One. Event Start Date
    Two. First Event ID of Recurring Events.
    Can you please provide two different functions for these. Also, do you have any hook or filter to check it before event start loading?

    #1325470
    Barry
    Member

    One. Event Start Date

    Absolutely, there’s a matching function to the one I already shared: tribe_get_start_date().

    Two. First Event ID of Recurring Events.

    There’s no existing function for this, but you can test to see if a specific event is recurring by using the tribe_is_recurring_event() function. You can then build some logic following this sort of pattern:

    • Is the post_parent 0 (zero)? If so, this is the ‘parent event’
    • If the post_parent greater than 0 (zero)? If so, that is the ID of the ‘parent event’

    You can then take the parent ID and find the children. A query that uses this to retrieve the first upcoming child in the series would like a little like this:

    $first_upcoming = tribe_get_events( array(
        'post_parent'    => $parent_id,
        'eventDisplay'   => 'list',
        'posts_per_page' => 1
    );

    I hope that helps!

    #1335565
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Tracking Series Event Start Date to Disable Gravity Form after start date passed’ is closed to new replies.