Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    did you mean the event saving hooks/filters ?

    Thread Starter writegnj

    (@writegnj)

    Hooks, Actions and Filters on https://codex.www.ads-software.com/Plugin_API

    if that’s what u talking about then YES.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    yes, however can I know which specific hooks you’ve wanted?

    Thread Starter writegnj

    (@writegnj)

    Thanks for the response angelo!

    I’m not very comfortable with PHP but I think this should work.

    I want to overwrite event_statue to “0” on em_events table(on database) when the Front-end event form submitted.
    I believe I can do this on my Theme’s functions.php file by adding the hook in there(below code; if it make sense).
    Can u tell me what hook that will be? if that exist.

    function update_event_statue($event_id){
    $thisposteventid = $EM_Event->event_id;
        global $wpdb;
        $wpdb->update( $wpdb->prefix . 'em_events',
    		array( 'event_status' => '0' ),
    		array( 'event_id' => $thisposteventid )
    		);
    add_action( 'EVENTS_MANAGER_HOOK', "update_event_statue" );

    If you take a look inside /events-manager/classes/ you’ll see the filters and hooks listed within the files. The one you need here is save_post.

    Thread Starter writegnj

    (@writegnj)

    Thank you calimin! I know I’m asking too much but my code is not working as I intended. could u plz help?
    is it even possible to overwrite event_status like the way I was trying below? It does insert 0 in to event_status in DB but it created new event_id right before actual event’s event_id(that contains all the data from front-end form).

    function update_event_status($event_id){
        global $wpdb;
        $wpdb->replace( $wpdb->prefix . 'em_events',
    		array( 'event_status' => '0' )
    		);
    }
    add_action( 'save_post', 'update_event_status' );
    Plugin Support angelo_nwl

    (@angelo_nwl)

    here’s another thread which may help you with this – https://wp-events-plugin.com/tutorials/saving-custom-event-information/

    Thread Starter writegnj

    (@writegnj)

    I have spent days to figure this out but I no luck so far. So I have to delete any old saves and insert new values?

    seems to me ‘save_post’ hook executes before the front-end form executes which means it’s gonna be overwritten by whatever values from front-end form.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Adding action hook on front-end form submission’ is closed to new replies.