Updating an Event

Home Forums Calendar Products Events Calendar PRO Updating an Event

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #28878
    Kyle
    Participant

    What is the proper syntax for using tribe_update_event to change post_status?

    I have been trying to use the wp_update_post array, updateEvent, and tribe_update_event but it is erasing the event meta (Start time, end time, etc.). I wasn’t able to find any example in the codex for them properly.

    $update_event = array(); $update_event[‘post_status’]=’draft’; tribe_update_event($post->, $update_order);

    The status is updating, but the event meta is being erased…

    #28880
    Jonah
    Participant

    Hi Kyle,

    Did you look at our documentation for this? https://theeventscalendar.com/support/documentation/the-events-calendar-advanced-functions-event-post-type/#functiontribe_create_event

    Can you paste the full code you are working with to http://snippi.com/

    Thanks,
    Jonah

    #28881
    Kyle
    Participant

    Its tough for me to paste the full code because it is in my payment gateway plugin, I tried to boil it down to just the parts that affect it. The event post status is meant to tie in to Woocommerce order status. http://snippi.com/s/qztnzvb

    #28900
    Jonah
    Participant

    Hi Kyle,

    So this code works for you but is wiping the event meta data?

    – Jonah

    #28901
    Kyle
    Participant

    Hey, thanks for following up

    Yes exactly, for some reason any time I use tribe_update_event or wp_update_post with an event post type the start and end times get wiped out.

    #28902
    Kyle
    Participant

    I also tried to pass the times back to the post inside the function.

    http://pastie.org/5479104

    #28904
    Jonah
    Participant

    Hi Kyle,

    Your code looks good to me so I’m not sure why it’s not working. I’ve passed this on to another developer to see if they can help troubleshoot. Stay tuned.

    – Jonah

    #28905
    Kyle
    Participant

    Jonah;

    Okay great, thanks for your help.

    Kyle

    #28945
    Samuel
    Member

    Hey Kyle!

    Very sorry for the issues you are running into. I also ran into this issue for version 2.0.10 testing the tribe_update_event() function just now, and have another dev coming in to check on it with me who is more involved with that part of the plugin.

    For now, i did also test wp_update_post() and found all my meta and event date did hold.
    Setting an event to draft from published worked fine for me running something like this:
    http://snippi.com/s/5hqp00s
    Can you verify your wp_update_post function is really wiping the meta/date while we look into resolving this bug? Is it totally removing the dates when using wp_update_post()?

    Thanks so much!

    sam

    #28949
    Kyle
    Participant

    Hey Sam, thanks for following up on this. I think I actually was able to figure out part of the problem. I had a separate function that was hooked into save_post which was causing an infinite loop (but only with events, which is why I thought it was with tribe_update_event). I appreciate you taking the time with this

    #28950
    Samuel
    Member

    Hey Kyle! So tribe_update_event() is working for you now? Because a test of the function for me in a clean dev environment did produce the same effect, wiping of meta and start/end time. sam

    #28951
    Kyle
    Participant

    Hey

    I switched over to wp_update_post, but I will test with tribe_update_event

    #28952
    Samuel
    Member

    That would be great if you could report back on that, I definitely experienced the same as you, but wp_update_post was fine. Thank you for taking the time!

    #28954
    Kyle
    Participant

    Okay, so after playing with the tribe_update_event function for awhile it seems that you simply have to pass the entire date/time variable back in the correct format each time, or it will reset the date. So something like this http://pastie.org/5482011 will work. It is essentially like using the tribe_create_event function each time.

    #28955
    Samuel
    Member

    Thanks Keith, I was beginning to find the same thing. I’m going to take a look at whether we can update the saveEventMeta function tied into create/update to be smarter in the case of updating. If not I’ll get the docs updated. Thank you again for taking the time to give feedback, appreciated!

    Sam

Viewing 15 posts - 1 through 15 (of 23 total)
  • The topic ‘Updating an Event’ is closed to new replies.