1

I had developed an extension (hooked with zoo_visitor_register_end) using Channel Entry API which creates a new channel entry by setting the title of this entry with a custom field value of Zoo Visitors.

But faced a sudden strange problem. Now its updating the new channel entry's title with member's email.

Everything was working great since more than 5 months. The problem came after updating EE 2.5.5 (2 weeks ago). Site is MSM.

I am hitting my head since yesterday but couldn't find any pointer. I 'll highly appreciate your help.

Edited * Below is the code I am using to create new entry via channel entry API:

$this->EE->load->library('api');
$this->EE->api->instantiate('channel_entries');
$this->EE->api->instantiate('channel_fields');

$data = array(
        'title'         => $member_data['CUSTOM_FIELD'],
        'entry_date'    => $this->EE->localize->now,
        'author_id'     => $member_id,
        'status'    => 'new',
        'site_id'   => $this->EE->config->item('site_id'),
        'channel_id'    => 14
);

if ($this->EE->api_channel_entries->submit_new_entry(14, $data) === FALSE)
{
    $errors = $this->EE->api_channel_entries->errors ;
}
else
{
    $entry_id = $this->EE->api_channel_entries->entry_id;
}
1

Be sure to pass the 'entry_id' index in the data array. It seems redundant, but I have ran into the same issue. Report back and let me know if this fixes your issue.

$data['entry_id'] = $entry_id;

$this->EE->api_channel_entries->update_entry($entry_id, $data);

It's important note, this is deprecated as of 2.6

http://ellislab.com/expressionengine/user-guide/development/api/api_channel_entries.html#update-entry

| improve this answer | |
  • Thanks justin, but I 'm using EE v2.5.5 and I am creating new entry not updating existing entry. I updated the question with the code. – GPY May 2 '13 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.