shortcode to browse category does not show any files under secondary categories

WP-Filebase Pro Forums General Support shortcode to browse category does not show any files under secondary categories

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1412
    Robin
    Participant

    Hi,
    I have a category structure

    
    Root
     |- 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?
    Thanks

    #1575
    Fabian
    Participant

    Thanks for posting. Will be included in the next update.

    Regards
    Fabian

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.