Trying to use ObjectiveHTML's public beta addon, Entries.

The thing is that I really need this addon to work, and the developer is not answering as this is a beta version. I looked at the code and this is the problematic area:

public function assigned_to_member()
    $channel = $this->param('from_channel', FALSE, FALSE);
    $entries = $this->EE->entries_model->get_assigned_entries($this->param('from_field', FALSE, FALSE, TRUE), $channel, $this->param('from_author_id', $this->EE->session->userdata('member_id'), FALSE));

    if($entries->num_rows() == 0)
        return $this->EE->TMPL->no_results();

    $entry_ids = array();

    foreach($entries->result() as $entry)
        $entry_ids[] = $entry->entry_id;    

    return $this->lib->entries(array(
        'channel'  => $this->param('channel', ''),
        'entry_id' => implode($entry_ids, '|'),
        'dynamic'  => 'no',
        'disable'  => 'disable="member_data|categories|category_fields|pagination"'

It gives me a mysql error like this:

Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND exp_channel_data.site_id = 1 AND author_id = 160' at line 4
SELECT `exp_channel_data`.`entry_id`, `author_id` FROM (`exp_channel_data`) JOIN `exp_channel_titles` ON `exp_channel_data`.`entry_id` = `exp_channel_titles`.`entry_id` WHERE exp_channel_data.channel_id = AND exp_channel_data.site_id = 1 AND author_id = 160
Filename: third_party/entries/models/entries_model.php
Line Number: 49

Here's the code referred to in that error (line 49 marked at bottom):

class Entries_model extends CI_Model {

public function __construct()

public function get_assigned_entries($field_name = FALSE, $channel, $member_id = FALSE)
    if(!preg_match('/^\d*$/', $channel))
        $channel = $this->channel_data->get_channel_by_name($channel)->row('channel_id');   

        $member_id = $this->session->userdata('member_id');

    $sql = array();

    $sql[] = 'exp_channel_data.channel_id = '.$channel;
    $sql[] = 'AND exp_channel_data.site_id = '.config_item('site_id');

        $field = $this->channel_data->get_field_by_name($field_name)->row();

            $sql[] = ' AND (field_id_'.$field->field_id.' LIKE \'%'.$member_id.'|%\' OR';
            $sql[] = ' field_id_'.$field->field_id.' LIKE \'%|'.$member_id.'\' OR';
            $sql[] = ' field_id_'.$field->field_id.' LIKE \''.$member_id.'\')';
            $sql[] = ' OR exp_channel_data.channel_id = '.$channel;
            $sql[] = ' AND exp_channel_data.site_id = '.config_item('site_id');

    $sql[] = 'AND author_id = '.$member_id;

    $sql   = rtrim(ltrim(implode(' ', $sql), 'OR'), 'AND');

    $this->db->select('channel_data.entry_id, author_id');
    $this->db->where($sql, NULL, FALSE);
    $this->db->join('channel_titles', 'channel_data.entry_id = channel_titles.entry_id');

( HERE IS THE LINE 49 --->) return $this->db->get('channel_data');

I am literally down. Any idea for a solution of this thing :( ?

  • Do you have a from_channel parameter defined? Sounds like you are missing a required parameter and the add-on isn't actually making it required. I saw that you emailed on this issue, so I will reply there and will report back here when we have an answer. And yes, this add-on is in beta, but it's still supported. However, support times are likely to be slower than the paid software (and since it's beta). – Justin Kimbrell Apr 23 '13 at 3:00
  • Hey, yes I did. Did you test the Assigned_to_me tag ? Cheers – Klauss Apr 23 '13 at 22:27

Your Answer

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

Browse other questions tagged or ask your own question.