Hi,
I have a client website, 4-5 years old, built on EE2 and updated over the years to the newest 5.3.0. Most of the channels were built during EE2 times. Currently when I add a new custom field to one of the channels, channel entry tag, listing all entries in the channel, stops listing them. When I remove this new custom field, everything gets back to normal and displays all entries. There are no PHP errors displayed on the website.
Tag used:
{exp:channel:entries channel="channelname" limit="35" dynamic="no" disable="categories|category_fields|member_data|pagination"}
On the other hand, when displaying specific entry, it works, like in example:
{exp:channel:entries channel="channelname" limit="1" require_entry="yes" disable="categories|category_fields|member_data|pagination"}
I was able to track SQL query that is supposed to return the list of entries and when this new custom field is added, it returns nothing:
SELECT t.entry_id, t.channel_id, t.forum_topic_id, t.author_id, t.ip_address, t.title, t.url_title, t.status, t.view_count_one, t.view_count_two, t.view_count_three, t.view_count_four, t.allow_comments, t.comment_expiration_date, t.sticky, t.entry_date, t.year, t.month, t.day, t.edit_date, t.expiration_date, t.recent_comment_date, t.comment_total, t.site_id as entry_site_id,
w.channel_title, w.channel_name, w.channel_url, w.comment_url, w.comment_moderate, w.channel_html_formatting, w.channel_allow_img_urls, w.channel_auto_link_urls, w.comment_system_enabled,
m.username, m.email, m.screen_name, m.signature, m.sig_img_filename, m.sig_img_width, m.sig_img_height, m.avatar_filename, m.avatar_width, m.avatar_height, m.photo_filename, m.photo_width, m.photo_height, m.group_id, m.member_id,
wd.*, exp_channel_data_field_1802.field_id_1802, exp_channel_data_field_1802.field_ft_1802 FROM exp_channel_titles AS t
LEFT JOIN exp_channels AS w ON t.channel_id = w.channel_id
LEFT JOIN exp_channel_data AS wd ON t.entry_id = wd.entry_id
LEFT JOIN exp_members AS m ON m.member_id = t.author_id LEFT JOIN exp_channel_data_field_1802 ON t.entry_id = exp_channel_data_field_1802.entry_id WHERE t.entry_id IN (5752,15765,6879,15708,15855,14417,45,54,6585,253,15820,15291,6862,397,5643,16464,301,274,458,7733,15889,8177,15871,15658,1174,17100,7394,5680,16077,5757,1176,6626,6823,7452,12661)ORDER BY FIELD(t.entry_id, 5752,15765,6879,15708,15855,14417,45,54,6585,253,15820,15291,6862,397,5643,16464,301,274,458,7733,15889,8177,15871,15658,1174,17100,7394,5680,16077,5757,1176,6626,6823,7452,12661)
The new custom field id is 1802. Maybe I’m doing something wrong or maybe it is some kind of bug in latest 5.3.0? I’m not sure but I think I have added some other custom fields in EE5 already, and in previous versions and it worked fine.
I don’t see why that left join should be mucking it up, but since you’ve got the query to work with, I’d start by just simplifying it down and identifying what’s the fail point. And then looking at it.
SELECT t.entry_id, t.channel_id, t.author_id, t.title, exp_channel_data_field_1802.field_id_1802, exp_channel_data_field_1802.field_ft_1802 FROM exp_channel_titles AS t
LEFT JOIN exp_channel_data_field_1802 ON t.entry_id = exp_channel_data_field_1802.entry_id WHERE t.entry_id IN (5752,12661)
So something like that. And if that has zero rows, drop the left join- make sure it returns 2 entries still, and if so, we dig into what’s going on there.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.