Event dates reset when setting edited events to return to pending status

Home Forums Calendar Products Community Events Event dates reset when setting edited events to return to pending status

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1172055
    Sean
    Participant

    Hi,

    We’ve been using the following snippet of yours for some time to set edited events to return to pending status:

    add_filter( 'tribe_events_community_sanitize_submission', 'set_community_events_publication_status' );
    function set_community_events_publication_status( $submission ) {
    $submission['post_status'] = 'pending';
    return $submission;
    }

    This has worked perfectly up until recently, when an update to the core plugin appears to have broken this. While it still returns published events to pending status upon being edited, the snippet creates an issue with the Start and End Date for events. Specifically, with the above snippet in function.php, if a user attempts to submit or edit an event via the Community Events form and is returned an error (e.g. they didn’t include the event title or another required field), then the Start Date and End Date are both reset (to the current date for new events, or in the case of events being edited, the date in the database). With the above snippet removed, this issue is not present.

    User’s aren’t expecting the dates to be reset and thus all of our newly submitted events are being submitted with the current dates, while edited events that are missing required fields are having their original dates submitted again even though the user had updated the date prior to trying to submit the form.

    Any ideas on what we need to do to continue setting edited events to return to pending status (a must for our site) with it not resetting the event dates for events?

    Thank you,
    Karly

    #1172229
    Brook
    Participant

    Howdy Karly!

    I can see what you mean, I am getting the same issue. This updated version of that snippet is fixing it for me, what about you?

    https://gist.github.com/elimn/f463ba3c9151cc7e17405c1ee8a39c1c

    Cheers!

    – Brook

    #1172248
    Sean
    Participant

    Good morning Brook,

    This works perfectly! As always thank you very much for the prompt reply and the fix. I’m sure others will find this helpful as well.

    Thanks and have a great day!
    Karly

    #1172743
    Brook
    Participant

    I am happy to hear it! Thanks for helping us spot that issue.

    Cheers!

    – Brook

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Event dates reset when setting edited events to return to pending status’ is closed to new replies.