I'm using Expression Engine's Channel Entries API and am having an issue with it.

User can add credits to their name. The storing of these credits work fine. If they choose to update their profile later on, it goes wrong.

I have this:

$data = array(
  'edit_date'       => time(),
  'entry_id'        => $credit_entry_id,
  'title'           => $credit["credit_upd_title_" . $credit_entry_id],
  'field_id_90' => $credit["credit_upd_director_" . $credit_entry_id],
  'field_ft_90' => 'none',
  'field_id_91' => $credit["credit_upd_year_" . $credit_entry_id],
  'field_ft_91' => 'none',
  'field_id_93' => $credit["credit_upd_link_" . $credit_entry_id],
  'field_ft_93' => 'xhtml',
  'category'        => $cat_arr 

When I dump this data, the data is correct. When I actually run:

$this->EE->api_channel_entries->save_entry($data, (int) $this->credit_channel_id, (int) $credit_entry_id)

everyting gets updated correctly EXCEPT for the title. The title instead is updated with the title of the parent_entry (this are playa entries).

Am I missing something in the usage of the API or am I encountering a bug?

  • Didn't get this working, must be an issue of playa within an entry. The API updates all my fields correctly, except for title and url_title. So I decided to just do a ee()->db->update for these fields, after the api save_entry().
    – Rien
    May 27, 2015 at 6:28
  • Did you get this working? I found your post because I'm looking to build some sort of credits system as well. Would you mind sharing your code? I'm looking to build something that will subtract a "credit" from the user (stored in a member field?) each time they post a new entry via Channel Forms. Nov 11, 2015 at 17:39
  • Wel, instead of using the $this->EE->api_channel_entries->save_entry function, I went for a db update statement. Something like this in my case: $this->EE->db->update('exp_channel_titles', array('title' => $data['title'], 'url_title' => $this->slugify($data['title'])), array('entry_id' => $new_credit_id));
    – Rien
    Nov 12, 2015 at 19:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.