Thread

Error when using 'author_id' or 'username' parameter in 'exp:channel:entries' tag

November 21, 2017 10:46pm

Subscribe [2]
  • #1 / Nov 21, 2017 10:46pm

    kmartens's avatar

    kmartens

    147 posts

    This is the error I get:

    Exception Caught

    SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘exp_channels.channel_idLEFT’ in ‘on clause’: SELECT t.entry_id , exp_channels.channel_id FROM exp_channel_titles AS t LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_idLEFT JOIN exp_members AS m ON m.member_id = t.author_id WHERE t.entry_id !=” AND t.site_id IN (‘1’) AND t.entry_date < 1511322261 AND (t.expiration_date = 0 OR t.expiration_date > 1511322261) AND m.member_id = ‘1’AND t.status = ‘open’ ORDER BY t.sticky desc, t.entry_date desc, t.entry_id desc LIMIT 0, 15

    ee/legacy/database/drivers/mysqli/mysqli_connection.php:116

    Can be reproduced with this simple code:

    <ul>
    { exp:channel:entries author_id="1" limit="15"}
     <li>Error when using 'author_id' parameter in 'exp:channel:entries' tag</li>
    { /exp:channel:entries}
    </ul>
    

    It appears to be due to how you are trying to add a join on exp_members and it’s triggered by part of the pagination routine on line 2187 of mod.channel.php.

  • #2 / Nov 22, 2017 10:56am

    Kevin Cupp's avatar

    Kevin Cupp

    727 posts

    Oops! You’re right, replace line 2251 of mod.channel.php with this and it should get you going again:

    $sql = str_replace(' WHERE ', ' ' . $member_join . ' WHERE ', $sql);

    Thanks!!

  • #3 / Nov 23, 2017 2:11am

    kmartens's avatar

    kmartens

    147 posts

    Not sure if this was supposed to be fixed in RC 1, but I noticed it’s fixed when there’s no pagination, but the issue persists with a different error when there is pagination.

    Exception Caught
    
    SQLSTATE[42S22]: Column not found: 1054 Unknown column 'm.member_id' in 'where clause':
    SELECT t.entry_id , exp_channels.channel_id FROM exp_channel_titles AS t LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_id WHERE t.entry_id !='' AND t.site_id IN ('1') AND t.entry_date < 1511420957 AND (t.expiration_date = 0 OR t.expiration_date > 1511420957) AND m.member_id = '1'AND t.status = 'open'
    
    ee/legacy/database/drivers/mysqli/mysqli_connection.php:116
    
  • #4 / Nov 27, 2017 3:16pm

    Kevin Cupp's avatar

    Kevin Cupp

    727 posts

    Oops! We’ll have this fixed in the next RC, thanks!

ExpressionEngine News

#eecms, #events, #releases