Okay
  Public Ticket #3507839
ICS Category Selection
Closed

Comments

  •  3
    elvisfrog started the conversation

    When you use the import feature and select an ics file you select the calendar but there is not option for category how does this get field out? Can you override a default categories for all ics event imports?

  •  894
    Zhivko replied

    There is a hook you can use to insert custom data before the actual creation of the event:

    $post_data = apply_filters('stec_ics_import_post_data', $post_data, $item, $this->calendar_data, $this->initiator, $this->post_type);
    

    E.g.

    add_filter('stec_ics_import_post_data', 'your_custom_function', 10, 5);
    /**
     * @param array $post_data - the stec_event post data array
     * @param array $item - the ics item object
     * @param array $calendar_data - the calendar data array
     * @param int  $initiator - the ics import initiator user id
     * @param string $post_type - the post type (stec_event, )
     * 
     */
    function your_custom_function($post_data, $item, $calendar_data, $initiator, $post_type) {
        // ... modify $post_data here
        $post_data['stec_cat'] = array(1, 2, 3); // add categories 1,2 and 3
        return $post_data;
    }
    

    Stachethemes Developer