Bug in bb-includes/functions.bb-forums.php w/Private Forums
-
Hello,
There is a bug in bb-includes/functions.bb-forums.php, at line 101 in bbpress v1.0.2. The code assumes that the forum_id is the sames the array_id when the array is flattened. This is not always the case if you apply_filters to the forum list such as private forums does.
The code ccurrently reads:
_forums[$_id] = $forums[$_id]
Which may not be true if the forum id is not the same as the array id.
This code does fixed the problem…. The key is to convert forum_id into an array enumerator so that when you look at $_ids you compare to the proper array which is no longer the full array but one with missing topics/forums.
$forums = (array) apply_filters( ‘get_forums’, $forums );
+ foreach($forums as $f) {
+ $fids[$f->forum_id] = $f;
+ }
if ( $child_of || $hierarchical || $depth ) {
$_forums = bb_get_forums_hierarchical( $child_of, $depth, $forums );
if ( !is_array( $_forums ) )
return false;
$_forums = (array) bb_flatten_array( $_forums, $cut_branch );
foreach ( array_keys($_forums) as $_id )
+ $_forums[$_id] = $fids[$_id];
- You must be logged in to reply to this topic.