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

    (@angelo_nwl)

    hi,

    sorry, can I know what customization you did for us to make a suggestion ?

    Thread Starter writegnj

    (@writegnj)

    I got custom front-end form and trying to save event data from it in functions.php with action hook.

    global $wpdb;
        $wpdb->insert( $wpdb->prefix . 'em_locations',
    		array(
    				'post_id'			=> $post_id,
    				'blog_id'			=> $blog_id,
    				'location_slug'		=> $location_slug,
    				'location_name'		=> $_POST['cf_location_name'],
    				'location_owner'	=> $current_user->ID,
    				'location_address' 	=> $fullstreet,
    				'location_town'		=> $_POST['cf_location_city'],
    				'location_state'	=> $_POST['cf_location_state'],
    				'location_postcode'	=> $_POST['cf_location_zipcode'],
    				//'location_country'	=> $_POST['cf_location_country'],
    				'location_country'	=> 'US',
    				'location_latitude'	=> $_POST['cf_location_lat'],
    				'location_longitude'=> $_POST['cf_location_lng'],
    				'location_status'	=> '1'
    			)
    		);
    
        $wpdb->insert( $wpdb->prefix . 'em_events',
    		array(
    				'post_id'				=> $post_id,
    				'blog_id'				=> $blog_id,
    				'event_slug'			=> $event_slug,
    				'event_owner'			=> $current_user->ID,
    				'event_status'			=> '0',
    				'event_name'			=>	$_POST['wpuf_post_title'],
    				'event_start_time'		=> $event_st,
    				'event_end_time'		=> $event_et,
    				'event_all_day'			=> '0',
    				'event_start_date'		=> $_POST['cf_date_start'],
    				'event_end_date'		=> $_POST['cf_date_to'],
    				'post_content'			=> $_POST['wpuf_post_content'],
    				'location_id'			=> $EM_Location->id,
    				'event_category_id'		=> $_POST['cf_event_category'],
    				'event_date_created'	=> $post_date,
    				'event_date_modified'	=> $post_modified
    			)
    		);
    }

    After submitting the form I saw data stored in Database but it goes to 404 page on front-end.

    Hiya,

    EM is a complex plugin that does a LOT of work in addition to storing post types.

    The method you’ve used isn’t available even for normal posts. You should be using the functions made available for inserting posts, not making database calls directly.

    See http://wp-events-plugin.com/documentation/advanced-usage/ for some of the methods available to EM.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom front-end form’ is closed to new replies.