6

I'm not sure there are any resources specific to this use case, but I've built quite a few add-ons which import channel entries. It's fairly straightforward with just a couple caveats: Inserting data for more advanced fieldtypes can be a bit tricky. Your best bet is to look at what fields are actually being submitted via the publish form in the control ...


4

ref: https://docs.expressionengine.com/latest/development/legacy/libraries/cache.html#class-methods ee()->cache->delete('/myaddon/');


4

This is a pretty late answer, and you likely already figured it out, but the $data array should use the database 'field_id_#' as the array key. So if the field id of your custom field 'foo' is 5, for example, then your data array would be: $data = array ( 'title' => 'bar', 'url_title' => 'bar', 'field_id_5' => 'bar', );


4

Within the channel entry API, you can pass the data array containing the array of category ids like: ee()->load->library('api'); ee()->api->instantiate('channel_entries'); ee()->api->instantiate('channel_fields'); $data = array( 'title' => 'ENTRY TITLE', 'entry_date' => time(), 'channel_id' => x, '...


3

You might try creating an RSS feed on the news site. It's fairly easy to setup an XML template and build it out using the standard RSS format, which you can find easily with a Google search. After you have an RSS template established, you can use the Feed Parser add-on on the other site to read and display the RSS feed contents.


3

As per your comments, you've already figured out the rather large annoyance of needing to pass all pre-existing fields with the save_entry function or else having them wiped out. I wanted to post an answer here though because there are a couple considerations I've come across when doing entry updates with my add-ons: 1) If you do not need the update to ...


3

I've managed to tackle this issue myself using the following. The key data structure is immediately below with a full example beneath that. This will handle all the relationship stuff automatically. Data array structure for relationships $data = array( 'title' => $title, 'entry_date' => $date, 'edit_date' => $date, 'field_id_29' =&...


3

Well, logically the last submitted insert query from the API is in the channel_data table. This tables Primary Key is entry_id, so you could try this CI command after you run the save_entry method: $new_entry_id = ee()->db->insert_id(); Check to make sure it's returning the correct entry_id. I'm assuming this works within an execution cycle and uses ...


2

There is no API for adding anything other than fieldtypes or tabs to the entry screen. I'd suggest one of two options: Build a fieldtype which displays your button and adds the javascript you need, then place a field which uses this fieldtype as the last field on the screen. Build an accessory which simply injects some javascript into the edit entry screen ...


1

Yeah, you can save relationship data using below Model query. In below code $entry->field_id_2 indicates the relationship data. $entry = ee('Model')->make('ChannelEntry'); $entry->channel_id = 'your_channel_id'; $entry->site_id = ee()->config->item('site_id'); $entry->author_id = ee()->session->userdata('member_id'); $entry->...


1

I too had the same issue, the EE documentation to put it nicely is rather incomplete on this topic. Looking though the source I saw an example in ft.relationships.php: ee('Model')->get('ChannelEntry', $entry_id) ->with('Children', 'Channel') ->fields('Channel.channel_title', 'Children.entry_id', 'Children....


1

It certainly is! Here's what you need to do (From the manual) based on your example : ee()->load->library('api'); ee()->api->instantiate('channel_entries'); ee()->api->instantiate('channel_fields'); //get the row to edit $query = ee()->db->select('title, url_title') ->from('exp_channel_titles') ->where('entry_id', $...


1

I've used DataGrab to achieve this in the past. Solspace Importer will also do the same.


1

So there is no way to do this with the EE API. You need to use the Database class and use the insert function like so. ee()->db->insert( 'field_groups', array( 'site_id' => 1, 'group_name' => 'Group Name' ) ); $group_id = ee()->db->insert_id(); return $group_id;


1

After having a phone call with DevDemon support last November, I resorted to using the CodeIgniter active record to update the entries instead. This is because the Store fieldtype uses Javascript to populate certain data when creating or updating an entry with the Store field type. When you use the channel entries API to create or update entries, it is ...


1

Lots of option here: Use a 3 level category structure: Region __City ____Place Select categories as required for each entry. You can then call all entries in each category, with each deeper level of category refining the results. Use 3 channels with relationships Regions channel (no relationships) Cities channel (relate city to Region entry) Places ...


1

I wrote this function... try it out... private function create_matrix_field($field_id, $type, $name, $label, $required = 'y', $search = 'y') { $matrix_columns = array('site_id' => $this->EE->config->item('site_id') , 'field_id' => $field_id , 'var_id' ...


1

You ideally should figure out a solution to the channel form error you are receiving, but as a possible workaround you will need to create your own add-on to do this. This is usually best achieved with a module that makes use of ACTions to post your form submission, but as there might be issues with this given the fact that channel forms aren't working ...


1

I know it seems redundant, but in the Channel Entries API you need to pass the entry_id in the data array. EE looks to that array to determine if the entry is being edit correctly (as far as the hooks go). I have tested this and confirmed it a while back, so I assume it's still true. Without the entry_id in the data array, the entry should get updated but in ...


1

Check out Rob Sanchez' EE Bootstrap: https://github.com/rsanchez/ExpressionEngine-Bootstrap It does just what you're looking for. I've used it myself for some projects where I didn't want to put code inside an EE add-on.


1

Turnes out the $_POST data for my field has everything I needed, and I used it like this: Instead of 'field_id_32' => $channel_form_obj->entry('job_photos') I did: 'field_id_32' => $_POST['job_photos'] Makes me wonder why the channel form object did not have that in the first place?


1

Short answer: there is no API for this. Longer answer: there is no API, but... You could either check out ObjectiveHTML's Channel Data library. You could also try and utilize the Channel module. However, that path is completely undocumented, so if you decide to go that route, tread lightly.


1

This StackOverflow answer shows how to extract a variable from a JSON string: https://stackoverflow.com/a/10689950/135935 Then echo that variable inside the exp:channel:form tag into a hidden field: <input type="hidden" name="product_id" value="<?php echo $ID ?>">


1

I was originally going to post this as a comment, but it's too long, so have opted for an 'answer'. You should be aware of the security implications of doing this as advised above. I've just created an add-on to do just this which will be executed via CRON - however, it needs to be pointed out that running: $this->EE->session->create_new_session(...


Only top voted, non community-wiki answers of a minimum length are eligible