[Plugin: WP-Filebase Download Manager] Bug in file list with multiple categories
WordPress v. 3.2.1
PHP v. 5.2.17
WP-Filebase v. 0.2.9.2
When using WP-Filebase to display a “file list” with multiple categories, only the files from the first category and the first category name are displayed.
Shortcode: [wpfilebase tag=list id=’4,1′]
Observed behavior: The category name and files for category 4 are displayed. The category name and files for category 1 are not, despite the fact that there are files in the category.
Expected behavior: The category name and files for all specified categories should be displayed.
Source of bug:
In classes/ListTpl.php, WPFB_ListTpl::Generate() on line 120, the following line appears:
if($n > $num) break; // TODO!!
$n is an index declared before the loop is entered (line 113) and incremented inside the inner loop that iterates over the files (line 126). $num is an argument originating in WPFB_Core::ShortCode() on line 237 and is declared with a value of zero. It does not appear to be modified along the call chain to Generate(), and in any case always had a value of zero in my tests.
Because $num is always zero, $n will exceed its value after one iteration of the inner foreach loop (line 124) and the condition on line 120 will be true on the second iteration of the outer foreach loop (line 114), causing categories 2..N to be skipped.
The simplest patch is to comment out line 120.
- The topic ‘[Plugin: WP-Filebase Download Manager] Bug in file list with multiple categories’ is closed to new replies.