I'm having a small issue creating a script that take in an entry_id, and based on that creates a new carbon copy entry with a new entry_id.
I've got this working, however as it stands now i'm forced to updated the $entry_data array everytime a new ee_channel_data field_id_# column is created.
ee()->load->library('api'); ee()->api->instantiate('channel_entries'); ee()->api->instantiate('channel_fields'); $entry_data = array( 'title' => $get_channel_title_res['title'] . ' COPY', 'url_title' => $get_channel_title_res['url_title'] . '_copy', 'entry_date' => $get_channel_title_res['entry_date'], 'edit_date' => $get_channel_title_res['edit_date'], 'field_id_1' => $get_channel_data_res['field_id_1'], 'field_id_2' => $get_channel_data_res['field_id_2'], 'field_id_3' => $get_channel_data_res['field_id_3'] ); ee()->api_channel_fields->setup_entry_settings($channel_id, $entry_data); $success = ee()->api_channel_entries->save_entry($entry_data, $channel_id);
I would prefer not to have to specify the fields, but simply tell EE's API Create a new entry, based on this old entry, and change it's title/url_title to appent _COPY.
I realize there's an addon for this, however that's not an option for me