[Bb-trac] Re: [bbPress] #913: get_forums hierarchical processing
breaks if filters are used
bbPress
bb-trac at lists.bbpress.org
Tue Aug 12 00:08:40 GMT 2008
#913: get_forums hierarchical processing breaks if filters are used
--------------------------+-------------------------------------------------
Reporter: chrispoirier | Owner:
Type: defect | Status: closed
Priority: normal | Milestone:
Component: Back-end | Version: 0.9.1
Severity: normal | Resolution: invalid
Keywords: |
--------------------------+-------------------------------------------------
Changes (by mdawaffe):
* status: new => closed
* resolution: => invalid
Comment:
The array is indexed by forum_id already.
The problem you mentioned is specific to the Private Forums plugin, and
has been fixed in that plugin.
I've pasted below what the old code was and commented where the fix should
have gone. Aditya (the author) fixed it a different way by using a
different set of filters to accomplish the same task.
{{{
apply_filters( 'get_forums', 'private_forums_filter_forums' );
function private_forums_filter_forums($forums) {
$new_forums = array();
if ($forums) {
$private_forums =
private_forums_custom_get_options('private_forums');
foreach($forums as $forum) {
if(!array_key_exists($forum->forum_id,$private_forums)) {
$new_forums[] = $forum;
// The above line should be replaced by the below line.
// $new_forums[$forum->forum_id] = $forum;
}
}
return $new_forums ;
}
return $forums;
}
}}}
--
Ticket URL: <http://trac.bbpress.org/ticket/913#comment:1>
bbPress <http://bbpress.org/>
Innovative forum development
More information about the Bb-trac
mailing list