WP-Filebase Pro › Forums › General Support › shortcode to browse category does not show any files under secondary categories
- This topic has 1 reply, 2 voices, and was last updated 10 years, 6 months ago by Fabian.
- AuthorPosts
- 2014-02-12 at 13:00 #1412RobinParticipant
Hi,
I have a category structureRoot |- A |- B
I store a file under A as the main category, and also reference it under B as a secondary category.
If I use a shortcode like:
[wpfilebase tag=browser path="B" /]the file doesn’t show up, but if I show the whole tree, the file shows under A and B
The SQL that is being run show that the ‘file_sec_cat1’ column is not being searched at all.
SELECT wp_wpfb_files.* FROM wp_wpfb_files WHERE ((file_category = 3 ) AND (1=1) AND file_offline = '0') ORDER BY <code>file_display_name</code> ASC
ideally we would want something that produces the same results as
SELECT wp_wpfb_files.* FROM wp_wpfb_files WHERE ((file_category = 3 OR file_sec_cat1 = 3 OR file_sec_cat2 = 3 OR file_sec_cat3 = 3) AND (1=1) AND file_offline = '0') ORDER BY <code>file_display_name</code> ASC
Changing line 209 of classes/Output.php from
$files = WPFB_File::GetFiles2(array('file_category' => $root_id), !empty($args['private']) ? 'private' : WPFB_Core::GetOpt('hide_inaccessible'), WPFB_Core::GetFileListSortSql((WPFB_Core::GetOpt('file_browser_file_sort_dir')?'>':'<').WPFB_Core::GetOpt('file_browser_file_sort_by')));
to
$files = WPFB_File::GetFiles2( WPFB_File::GetSqlCatWhereStr($root_id), !empty($args['private']) ? 'private' : WPFB_Core::GetOpt('hide_inaccessible'), WPFB_Core::GetFileListSortSql((WPFB_Core::GetOpt('file_browser_file_sort_dir')?'>':'<').WPFB_Core::GetOpt('file_browser_file_sort_by')) );
fixes the problem.
Can this be rolled into the next release if you’re happy with the code?
Thanks2014-03-10 at 22:07 #1575FabianParticipantThanks for posting. Will be included in the next update.
Regards
Fabian - AuthorPosts
- You must be logged in to reply to this topic.