Support » Plugin: Events Manager » Events not creating when code is running in backend

  • Resolved sanaconeltantra

    (@sanaconeltantra)


    Hi guys,
    I’m using the code here to create an event programmatically and it runs great when into a PHP page called directly by the browser but not in the backend when a hook is triggered. Any idea why the event doesn’t get created?
    It does go through the code as I can output some data to a file. I can also add an EM booking that way but not an event and i don’t get any error.
    Here is the hook :
    <?php
    add_action( ‘ea_new_app_from_customer’, ‘custom_callback_function’, 10, 2 );
    function custom_callback_function( $appointment_id, $appointment_data ) {
    $to = ‘toto@gmail.com’;
    $subject = ‘Confirmation’;
    $body = $appointment_id . ‘-‘ . print_r($appointment_data,true);
    $headers = array(‘Content-Type: text/html; charset=UTF-8’);

    // Change the slug to event name and date.
    function ce_change_event_slug( $result, $event_obj ) {
    ….

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sanaconeltantra

    (@sanaconeltantra)

    Thread Starter sanaconeltantra

    (@sanaconeltantra)

    It’s ok I found out why, in the backend WP is expecting this date format :
    $event_start_date = ’16/11/2020′;
    When in the frontend it was like this :
    $event_start_date = ‘2020-11-16’;
    So I was getting these errors :
    [13-Nov-2020 03:45:04 UTC] PHP Notice: Trying to get property ‘valid’ of non-object in /home2/eltemplo/public_html/blog/wp-content/plugins/events-manager/classes/em-event.php on line 1547
    [13-Nov-2020 03:45:04 UTC] PHP Notice: Trying to get property ‘valid’ of non-object in /home2/public_html/blog/wp-content/plugins/events-manager/classes/em-event.php on line 1547
    [13-Nov-2020 03:46:41 UTC] PHP Deprecated: WPSEO_Utils::get_title_separator is deprecated since version WPSEO 15.2 with no alternative available. in /home2/public_html/blog/wp-includes/functions.php on line 4787
    [13-Nov-2020 03:47:07 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /home2/public_html/blog/wp-content/plugins/query-monitor/classes/Backtrace.php on line 97
    [13-Nov-2020 03:47:07 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /home2/public_html/blog/wp-includes/functions.php on line 6335

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Events not creating when code is running in backend’ is closed to new replies.