Hi,
I am using this code (within a exp:channel:entries tag) to present images which belong in a particular category:
{categories show_group="3"}
{exp:file:entries limit="5" directory_id="2" category="{category_id}"}
{file_url}
{/exp:file:entries}
{/categories}When no images are in a certain category this returns notices and errors:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: database/DB_active_rec.php
Line Number: 1724
AND
Error Number: 1052
Column 'site_id' in where clause is ambiguous
SELECT `exp_files`.`file_id`, `variable_name`, `variable_data` FROM (`exp_files`, `exp_global_variables`) INNER JOIN `exp_file_categories` ON `exp_files`.`file_id` = `exp_file_categories`.`file_id` INNER JOIN `exp_categories` ON `exp_file_categories`.`cat_id` = `exp_categories`.`cat_id` WHERE `upload_location_id` = '2' AND `exp_categories`.`cat_id` = '2' AND `site_id` = '1'
Filename: libraries/Template.php
Line Number: 2989The easy fix is to go to libraries/Template.php and change line 2988 to:
ee()->db->where('exp_global_variables.site_id', ee()->config->item('site_id'));(adding the tablename)
The pages do render then, but generate even more notices and a new error:
Error Number: 1052
Column 'site_id' in where clause is ambiguous
SELECT `exp_files`.`file_id`, `last_cache_clear` FROM (`exp_files`, `exp_stats`) INNER JOIN `exp_file_categories` ON `exp_files`.`file_id` = `exp_file_categories`.`file_id` INNER JOIN `exp_categories` ON `exp_file_categories`.`cat_id` = `exp_categories`.`cat_id` WHERE `upload_location_id` = '2' AND `exp_categories`.`cat_id` = '2' AND `site_id` = '1'
Filename: libraries/Core.php
Line Number: 733I can fix this the same way as above, only using exp_files. The notices will not disappear.
However I am afraid hardcoding this will break other things in EE.
What is your advice on this?
EE version: 2.8.1
File module version: 1.0.0
—UPDATE—
Turns out making the changes I did above here indeed breaks other things. Someone please come up with a better idea :(
—UPDATE 2—
As temporary fix I commented out the lines I pasted above: 732 in libraries/Core.php and 2988 in libraries/Template.php.