Success and Error Messages (specifically on the front-end)

WordPress Event Management, Calendars & Registration Forums General Question Success and Error Messages (specifically on the front-end)

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 9 years, 12 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10708

    Hey, long time no chat eh 🙂

    As I’ve mentioned previously, I am using the gist you created for a front-end editor. It utilizes eo_insert_event(). I was wondering, does this return some sort of error message if the event is not created successsfully? I would like to be able to provide some feedback to the user on whether or not their event was created successfully. If not, would I just need to validate the form prior to submitting the data to ensure the event is created successfully?

    • This topic was modified 9 years, 12 months ago by  Gabriel David.
    Gabriel David
    #10726

    Yes it does, in fact it behaves almost identically to wp_insert_post(). In case of an error a WP_Error object is returned. In the case of an event submission form, it should be sufficient to try eo_insert_event() which performs its own validation.

    Of course, eo_insert_event() requires a DateTime object for ‘start’, ‘end’ and (optionally) ‘repeat until’ dates, so you’ll probably need to perform some sort of validation when converting the value entered by the user into a DateTime object. For this you can use eo_check_datetime()(- which is not well documented but is simply a wrapper for date_create_from_format() with a php5.2 fallback. You can find it in includes/event-organiser-utility-functions.php). This function allows you to pass a string date value, and the format (you expect) it is in, and it’ll try to parse that value into a DateTime object. If it can’t, it returns false.

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.