Forums

[plugin development] Do action on on post creation or update (1 post)

  1. collimore
    Member
    Posted 1 year ago #

    hi!
    I'm developing a simple plugin that permit to assign a streming event to a post, during its creation or update(then are present input fields in edit page, that i have to save into a table in db).
    I added 2 hooks:

    add_action( 'edit_form_advanced', 'add_streaming_form' );
    add_action( 'edit_page_form', 'add_streaming_form' );

    When i compile the plugin form in the edit page, and publish it, I guess i could find input field values in $_POST array, but it seems not to be so.
    At begin of 'add_streaming_form', i added this lines

    if (isset($_REQUEST[event_created]) && $_REQUEST[event_created] == 'true'){
    		global $wpdb;
    
    		$event=array();
    		$event[str_name]= $_POST['event_name'];
    		$event[str_created]= date('Y-m-d H:i:s');
    		$event[str_start]= $_POST['event_start'];
    		$event[str_end]= $_POST['event_end'];
    		$event[post_id]=$post_id;
    
    		 $wpdb->insert('wp_streaming', $event);
    
    }

    but the $_POST variables are all empty.
    What am I doing wrong?Suggestion?
    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic